Fustrate/ToxG — Issue #10: Rethinking References
Author: Fustrate
Created: 2012-01-13 00:37:05+00:00
State: open

I've been thinking about what might be difficult to newcomers in ToxG, and this is one thing I think really needs to change. Currently, references' parameters and formats and defaults are a slew of semicolons and characters, and it's not too hard to mess something up in there.

What I'm proposing is a new format for references in general, one that should be easier for people to remember, write, and debug.

Instead of using semicolons (and a "strange" character for a default), why not make it more human, like this?

`{$var:{%upper:$param}:$param2:"Three"|"N/A"}` -> `{$var {$param %upper} $param2 "Three" default:"N/A"}`

Basically, the format is:

Variable or language reference (`$varname` / `#langkey`, must be first, rest can be in any order)
Parameters (Any mix of references, numbers, strings, 0+)
Formats (`%upper` `%date:"n/j/Y"` `%money` 0+)
Default (`default:"Undecided"`, optional)

It's a bit longer, but in my eyes it's a lot more readable and understandable. Looking for input before I write and commit it (we might fork ToxG from this more-pure version for smCore, by the way.)