I wish to suggest a simpler method to allowing dynamic variables, or variable arrays, in addition to the current methods.

Currently:
Code:
inc %FLOOD.TEXT. [ $+ [ $cid ] $+ . $+ [ $chan ] $+ . $+ [ $nick ] ]
if ($($+(%,FLOOD.TEXT.,$cid,.,$chan,.,$nick),2) >= 10) { do stuff }


Suggestion:
Code:
inc %FLOOD.TEXT[$cid][$chan][$nick]
if (%FLOOD.TEXT[$cid][$chan][$nick] >= 10 { do stuff }


By forcing evaluation of the contents of []'s within variable names, mIRC should be able to create dynamic variables, including the '[' and ']', that are easier to read and manipulate.

I understand the scope of issues affecting the implementation, parsing, use, and backward compatibility of variable arrays. I believe this method should both minimize compatibility issues with existing scripts, while being extremely user-friendly and intuitive to all users.

Synopsis:

/set %array[1] : creates a variable named %array[1], as already does.
/set %array[%i] : creates a variable named %array[1], evaluating the contents of [], %i.
/set %array[$me] : creates a variable named %array[Raccoon], evaluating the contents of [], $me.

I'm using %array as an example. This would apply to any variable containing a '[' and ']' in its name.

Only the contents of [...] is actually evaluated.
No spaces are required or permitted.
Multiple sets of [...] are evaluated.

/set %array[$me][$chan] : creates a variable named %array[Raccoon][#mIRC]
/set %array[$me]foo[$chan] : creates a variable named %array[Raccoon]foo[#mIRC]
/set %array[$me]$foo[$chan] : creates a variable named %array[Raccoon]$foo[#mIRC]

If the evaluated variable or identifier contains spaces, or variable-name prohibited characters, they are replaced by underscores "_".

/set %array[$me][$1-] : creates a variable named %array[Raccoon][Hello_world.]

Using the variables doesn't require any special evaluation with $eval() or the like.

/echo -a %array[$me][$chan] : should work as expected.
if (%array[$me][$chan] == $true) : should work as expected.

Parser Issues:

I understand that there are a multitude of parser / evaluation issues involved. I know that commands like /set and /var treat the first parameter (%variable) in a special way so as not to evaluate the variable but treat it as an explicit name.

Since mIRC already has special handling in place for recognizing and evaluating variables as appropriate, I simply suggest checking if the variable name contains [] and gives the contents of [] a round of personalized evaluation before naming the variable.

This should not affect existing scripts with variables containing [], since %variable[xyz] is still %variable[xyz]. This would only affect scripts that explicitly tried naming variables %variable[%foo] or %variable[$foo]. This type of naming convention is RARE and likely unseen in wide use today.

mIRC should continue to treat dynamic evaluation through use of %variable [ $+ [ $foo ] ] the same as it currently does. Since there are no touching [], this should be a simple matter.


Please give this suggestion some consideration so we can get on with simple dynamic variable arrays without the messy use of %xyzzy [ $+ [ $foo ] or $($+(%,xyzzy,$foo),2) which is painfully hard to read.

Thank you Khaled.

Eric aka Raccoon/EFnet


Well. At least I won lunch.
Good philosophy, see good in bad, I like!