Smylers [mailto:[EMAIL PROTECTED]] wrote:

> And an alternative
> spelling for the assignment operator[*0] doesn't strike me as something
> Perl is really missing:
> 
>   $msg <~ 'Hello there';
>   $msg = 'Hello there';


I still remember the first time I saw a computer program, before I had
learned anything about programming myself. A friend showed me his first
Fortran program, and it included the following line:

  N = N + 1

I stared at that in puzzlement for a long minute, and then said "That sure
isn't true for any value of N that *I* know of!" Then he told me that "="
doesn't mean "equals" in Fortran (no, *that's* spelled "EQ" :-). 

I've always been bothered by this misuse of mathematical notation, which is
used in an incredibly bewildering array of computer programming languages.
On the other hand, I've never been a fan of the ":=" spelling of assignment,
either. I always thought that "<-" was much better, except for the pitfall
that humans are likely to misread "a<-5" as a comparison. 

One of the most... er, *interesting*, dodges I've seen in this area is the
one used by Squeak (a Smalltalk variant). Squeak spells assignment with an
underscore ("_"), but the Squeak system *draws* it as a left-pointing arrow.
Hey, I know: let's not bother with Unicode...let's just reassign a few ASCII
control characters for Perl's use!   :-)

I, for one, could live with "<~" as the only assignment operator. But I only
suggest it tongue in cheek.



Speaking of Squeak, I notice that Buddha Buck just posted a
Smalltalk-translated-to-Perl implementation of the if-operator:
> class True is Bool is singleton {
>...
> our True true is builtin;
>etc.

which even includes the notion that the implementation of True and False is
immutable, so that the code generator has a ghost of a chance of knowing
what to do!

That was followed by Austin Hastings' post:

> log $user onto $system.
> log $message to $stderr.
> l2x = log 2 * log $x;   # Don't check my math, please. :-)
> ...
> sub log($n) { ... }
> sub log _ onto($user; &_ ; $machine) { ... }
> sub log _ to($message; &_ ; $stream) { ... }

which is a recycling of Smalltalk's "inject:into:"-style operators. I have
to admit that I *like* the idea of being able to define those kinds[1] of
operators; they can really add to the clarity of the code. I just don't want
to have to write the parser!
[1] What *do* you call this style of operator -- intermingled-fix?

Looks like we've got some Smalltalk fans here. What say we start a new
mailing list for designing Perltalk?  :-)

=thom
Riker: "They were just sucked into space."
Data:  "Blown, sir." 
Riker: "Sorry, Data."
Data:  "Common mistake, sir."
(The Naked Now) 

Reply via email to