My point is it would be as difficult (by the same token, as easy) to implement this for variable names only as it would be to implement this kind of interpolation everywhere. The only difference is that there would now be a new syntax to denote a variable,identifier or "#": {%var}, {$ident} and {#} respective. The boundaries in all cases would be simple to parse, so this would not be difficult to implement. All you'd do is add in the following logic in the current parser: "if char is '{' and next char is one of ($, % or #), evaluate contents until matching '}' in place". This same logic would be inside the parsing of variable names too, but that's insignificant thanks to the wonders of recursion. Note that this would be *as easy* as your logic for variable names only; in fact, it *is* the same logic: "if char is '[' and next char is ... evaluate contents in place". Technically your [] syntax could be used in place of my {} syntax for the exact same interpolation I suggested. The only difference being {} seems a little less ambiguous-- a script may for instance use [$2.00] to represent a dollar amount, {$2.00} would be less likely (though entirely possible). To me the latter seems more obvious as interpolation, anyway...

By the way, I wasn't suggesting the use of (), I was suggesting the use of {}, which in the current grammar must be spaced on either side to be identified as part of control flow. My proposed syntax requires that {} not be spaced, so it could never interfere with the normal use case for braces.

- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"