Someone made mention recently that you can't assign to a variable using the deref operator on a numeric expando, but you can using a param:
# This works alias testalias1 (varname) { @ *varname = 'booya' } # This does not work alias testalias2 { @ *0 = 'booya' } The reason for this has to do with how tokens are handled in the math parser. There are three types of tokens: 1) A bare variable name varname 2) A string 'booya' 3) A number 0 When you use the deref operator on a variable name, it converts the rvalue of that variable into an lvalue. assign varname testing # this assigns 'this is a test' to $testing *varname = 'this is a test' # So *varname is the same as $testing... *varname == 'this is a test' # So this is always true *varname == [$($varname)] When you use the deref operator on a *number*, it expands to the rvalue of the numeric expando of that number, and does *NOT* convert that rvalue into an lvalue. This is what allows you to do: @ foo = *0 But the thing that allows you to do that is the same thing that doesn't allow you to do: @ *0 = 'testing' Because *0 is $0 and not $($0): # This is false! *0 == [$($0)] # This is true *0 == [$0] # This is true! *varname = [$($varname)] # This is false! *varname = [$varname] Derefing variable names and numbers are at odds with each other. So it is not possible for both @ *0 = 'testing' and @ foo = *0 to both work at the same time. So for backwards compatability, we will maintain the current behavior, even though it's not consistent. All is not lost -- you *can* assign to a variable name passed as $0, you just have to deref it a second time, because *0 yields an rvalue, and you can just deref it again to turn it into an lvalue: # This assigns to the variable passed as $0 @ *(*0) = 'testing Consequently, I recommend we make no change to how this works. Comments, thoughts, questions, improvements, suggestions? Jeremy _______________________________________________ List mailing list List@epicsol.org http://epicsol.org/mailman/listinfo/list