mIRC Homepage
Posted By: Raccoon Bug in $+() or expected behavior? - 12/09/19 06:36 AM
//var %foo = bar | echo -a $+(test,123,(,%foo,),xyzzy,(,plugh,))
> test123(,%foo,)xyzzy(,plugh,)

Same deal with $eval() aka $().

Seems that parenthesis within these identifiers (and possibly others) creates a nesting protection between parameters.

Kind of like the nesting peren protection we enjoy when using commas and curly brackets {} within a regular expression pattern.

Just wasn't expecting this. Maybe it's useful? Has it been like this a very long time?
Posted By: Khaled Re: Bug in $+() or expected behavior? - 12/09/19 07:56 AM
Thanks for your bug report. This is by design. The () brackets are used to contain the parameters of the identifier. These are how the parser determines the beginning and ending of a bracketed identifier. If you need to use these inside an identifier, you should assign the parameter to a variable first.
Posted By: Protopia Re: Bug in $+() or expected behavior? - 12/09/19 01:25 PM
Alternatively use $chr(40) for "(" and $chr(41) for ")" i.e.
Code
//var %foo = bar | echo -a $+(test,123,$chr(40),%foo,$chr(41),xyzzy,$chr(40),plugh,$chr(41))
> test123(bar)xyzzy(plugh)


Or to make it even more readable use an alias identifier $lbr for $chr(40) and $rbr for $chr(41).
© mIRC Discussion Forums