OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Add \ref support for strings

Open ike709 opened this issue 3 years ago • 5 comments

ike709 avatar Jun 12 '22 03:06 ike709

Is this related to #700?

Hinaichigo avatar Jun 12 '22 12:06 Hinaichigo

no

ike709 avatar Jun 12 '22 16:06 ike709

Spurious CI failure again. I think github is having an issue.

ike709 avatar Jun 14 '22 18:06 ike709

Isn't this going to permanently leak all strings passed through \ref? You may want a different string tree that uses weak references instead, and some sort of cleanup routine.

PJB3005 avatar Jul 18 '22 12:07 PJB3005

True but this is still pretty much a placeholder ref implementation anyways to bandaid round init while we work on other things.

ike709 avatar Jul 18 '22 17:07 ike709

Review addressed but I haven't thoroughly tested the changes.

ike709 avatar Sep 24 '22 21:09 ike709

This breaks locate() for DreamObjects currently. locate("10") looks for a DreamObject with ID 10 instead of 0.

wixoaGit avatar Sep 26 '22 20:09 wixoaGit

Ready for review

ike709 avatar Sep 27 '22 23:09 ike709

Isn't this going to permanently leak all strings passed through \ref? You may want a different string tree that uses weak references instead, and some sort of cleanup routine.

Yes, this will allow you to get any string existing at compile time or passed through ref(). This is actually similar behavior to byond, which can be observed with the following code:

for (var/i in 1 to 0x1a0)
	world.log << locate("\[0x6000[num2text(i, 3, 16)]\]")

I don't think a cleanup routine would be possible, as there's no way to tell when the code will want to locate() it.

wixoaGit avatar Sep 29 '22 15:09 wixoaGit