mIRC Home    About    Download    Register    News    Help

Print Thread
Bug in $+() or expected behavior? #266038 12/09/19 06:36 AM
Joined: Feb 2003
Posts: 2,669
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,669
//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?


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: Bug in $+() or expected behavior? [Re: Raccoon] #266040 12/09/19 07:56 AM
Joined: Dec 2002
Posts: 4,588
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,588
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.

Re: Bug in $+() or expected behavior? [Re: Raccoon] #266043 12/09/19 01:25 PM
Joined: Aug 2003
Posts: 246
P
Protopia Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 246
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).