|
Posted by David Haynes on 03/12/06 15:25
rlee0001 wrote:
> Gary,
>
> One thing about that is that it is counter-intuitive to read. For
> example you are not asking "if 'fred' equals your name..." but rather
> "if your name equals fred'...".
>
> That said, your method is a very practical solution to a common
> problem.
>
> In a way I kinda wish that the '=' operator worked like the ECHO
> construct in that you wouldn't be able to use it as a function. That
> way if your source tried to actually look at the result of an '='
> assignment a syntax error would occur (like the distinction between
> echo and print). The only side effect would be that you would be unable
> to chain assignments like this:
>
> a = b = c = d = 0;
>
> But an alternate method could be added to the language such as:
>
> (a, b, c, d) = 0;
>
> Which I think is actually used by LISP if I recall correctly.
>
> But of course I'm just dreaming/thinking out loud here. :o)
>
> -Robert
>
Why not change all the primitives to objects and then move the '='
operation to equal()? Then you could have:
$a->equal($b)
Or DEFINE the '=' to be '.equals.'? Then it would be:
$a .equals. $b
[Just joking. Programmers in other languages may recognize these.]
-david-
Navigation:
[Reply to this message]
|