OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Fold constant AST expressions into strings instead of interpolating them

Open out-of-phaze opened this issue 1 year ago • 5 comments

This is technically not something BYOND is great at doing. It means things like set name = "FOO ([STRING_DEFINE])" will no longer error, which is good; they work fine in BYOND, I'm pretty sure. However, it also means that var/const/foo = "FOO ([STRING_DEFINE])" will work, which technically breaks parity with BYOND, but only in that it's more permissive.

out-of-phaze avatar Sep 17 '22 18:09 out-of-phaze

Acceptable parity break IMO

ike709 avatar Sep 17 '22 19:09 ike709

We're going to "parity break" a lot with having better constant-folding than BYOND. None of that will ever negatively affect the behaviour of any targetted codebase, though. It just means better performance at runtime. Don't worry about it!

Altoids1 avatar Sep 17 '22 19:09 Altoids1

Should this fix #700?

Hinaichigo avatar Sep 18 '22 04:09 Hinaichigo

Should this fix #700?

No.

out-of-phaze avatar Sep 22 '22 01:09 out-of-phaze

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Oct 11 '22 18:10 github-actions[bot]

Turns out the name thing doesn't actually work and both are bugged in BYOND. Still, acceptable parity break etc.

out-of-phaze avatar Nov 24 '22 19:11 out-of-phaze

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Dec 04 '22 01:12 github-actions[bot]

I'm not a fan of this method of constant-folding string interpolations. The AST should strive to stay as true to the source as it can, and something like this would be better done in the string's DMExpression.

I'm going to close this since it's getting rather stale and I'd prefer this be re-done in another PR.

wixoaGit avatar Jan 15 '23 04:01 wixoaGit