Add Unit Lexer - #436
Conversation
Chadnaut
commented
Aug 24, 2026
85b7766 to
d6b370b
Compare
|
So how does it work? You'll have to define all the units in the script? |
|
Works with any function. For built-in globals just add them to |
|
That's a very clean patch. Cleaner than mine. So what's your plan regarding overridability of these functions? |
|
No plans, it's the same as everything else. If you name it the same it'll override the existing function. |
|
Hmm, this may break layouts without throwing any errors. People may not know that internally units are transcribed to function calls. |
|
So basically any function will be called when you for example |
|
Won't break any existing layouts since they won't be using the new units. Yes, any valid identifier suffixing any valid number will be called. |
Yeah I know, and I'm not sure if I like it.
My implementation just throws an error, which is a good thing in my opinion. |
|
This implementation is generic and flexible. Ultimately the user has complete control. Those who override native functions should know what they're doing, if not they're destined for trouble eventually. Overrides are essential to extend functionality, add effects, logging, etc. The ability to create your own units is useful too. Columns, rows, padding, steps, etc. Units are just another shortcut. |