Not logged inOpenClonk Forum
Up Topic Proplist references

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Günther

> Couldn't we just make "expr[expr] = expr" and "variable = expr" the grammar rules, and code everything in there?


Well, we could, but it'd require significant changes to the parser. Consider (foo)=bar. At the point where the parser sees the =, the bytecode for foo has already been written. It might be possible to delete that bytecode, write the bytecode for the second expression, and then add the write-to-variable bytecode. But that's gross. So, we'd have to switch to a proper AST first.

Also, += and friends would have to change to read+modify+write bytecodes to avoid having 78 bytecodes for this (13 operators * 6 destination types). Or we'd need to change the bytecodes to encode the destination in the bytecode, instead of always pushing it onto the stack.

And I've got another idea: If we impose the rule that all functions with the same name have the same type - reference or no reference - of parameters and return values, the parser would know whether a certain function parameter needs a reference. That way, we wouldn't need special proplist references, because no reference would be created that the scripter didn't intend.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill