New syntax for blocks

R

Russ P.

And if I ever find the genius who had the brilliant idea of using = to mean assignment then I have a particularly nasty dungeon reserved just for him.  Also a foul-smelling leech-infested swamp for those language designers and compiler writers who followed his example.  (Come to think of it, plagiarizing a bad idea is probably the worse evil.)

There is absolutely nothing wrong with using = for assignment. The
problem in C was allowing an assignment within a conditional
expression. Now *that* was a bonehead idea! (Hingsight is 20/20, of
course.) Python does not allow that, so there is no problem. Nor do
most other languages allow it.
 
G

greg

MRAB said:
Fortran uses "=" and ".EQ.", probably because (some) earlier autocodes
did.

I think Fortran used .LT. and .GT. because some early character
sets didn't have < and > symbols. Having done that, it
probably seemed more consistent to use .EQ. for comparison
than to break the pattern and use =.
 
G

greg

r said:
I think the syntax was chosen because the
alternatives are even worse AND since assignment is SO common in
programming, would you *really* rather type two chars instead of one?

Smalltalk solved the problem by using a left-arrow character
for assignment. But they had an unfair advantage in being
able to use a non-standard character set on their custom-built
machines.

We should be able to do a lot better now using Unicode.
We could even heal the <> vs != rift by using a real
not-equal symbol!
 
S

Steven D'Aprano

Smalltalk solved the problem by using a left-arrow character for
assignment. But they had an unfair advantage in being able to use a
non-standard character set on their custom-built machines.

We should be able to do a lot better now using Unicode. We could even
heal the <> vs != rift by using a real not-equal symbol!

The problem isn't with the available characters, but with *typing* them.

It is hard to enter arbitrary Unicode characters by the keyboard, which
frankly boggles my mind. I don't know what the state of the art on Mac is
these days, but in 1984s Macs had a standard keyboard layout that let you
enter most available characters via the keyboard, using sensible
mnemonics. E.g. on a US keyboard layout, you could get ≠ by holding down
the Option key and typing =.

For me, I had to:

Click Start menu > Utilities > More Applications > KCharSelect.
Click through thirty-four(!) tables scanning by eye for the symbol I
wanted.
Click the ≠ character.
Click To Clipboard.
Go back to my editor window and paste.
 
R

r

The problem isn't with the available characters, but with *typing* them.

It is hard to enter arbitrary Unicode characters by the keyboard, which
frankly boggles my mind. I don't know what the state of the art on Mac is
these days, but in 1984s Macs had a standard keyboard layout that let you
enter most available characters via the keyboard, using sensible
mnemonics. E.g. on a US keyboard layout, you could get ≠ by holding down
the Option key and typing =.

For me, I had to:

Click Start menu > Utilities > More Applications > KCharSelect.
Click through thirty-four(!) tables scanning by eye for the symbol I
wanted.
Click the ≠ character.
Click To Clipboard.
Go back to my editor window and paste.

♂ <-- Heres a free lesson... Stephen, hold down <CNTRL> and press
<KEYPAD-1> twice, then release <CNTRL>. ;-)

PS: But please lets not start using Unicode chars in programming, you
guy's already know how much i *hate* Unicode.
 
G

Gregory Ewing

Steven said:
I don't know what the state of the art on Mac is
these days, but in 1984s Macs had a standard keyboard layout that let you
enter most available characters via the keyboard, using sensible
mnemonics. E.g. on a US keyboard layout, you could get ≠ by holding down
the Option key and typing =.

They all still seem to work -- presumably generating the
appropriate unicode characters now instead of MacRoman.

I don't think there's any left-arrow character available
on the keyboard though, unfortunately.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top