Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: suprise with -=



On Oct 21, 11:01am, Ray Andrews wrote:
} Subject: Re: suprise with -=
}
} On 10/19/2015 05:27 PM, Bart Schaefer wrote:
} > The parser doesn't know that "first" is an integer, or even that it's
} > a variable that was previously declared.
} That puzzles me.  Have not all your examples demonstrated that the 
} parser is aware of the type of the variable and that it will perform 
} it's operations accordingly?

No.  Parser is syntax, not semantics.  It knows "x=y" has a valid shape,
and to create code to invoke an assignment at run time, but not what the
assignment will do with x or y when run.

You can think of "third=first+second" as syntactic sugar for the command
"typeset third=first+second" -- it's the command that knows the type of
the variable, not the parser.



Messages sorted by: Reverse Date, Date, Thread, Author