For Consistency...

  • Thread starter Lawrence D'Oliveiro
  • Start date
L

Lawrence D'Oliveiro

OK, so this isn’t specifically a Java thing, but ...

The opposite of “==†shouldn’t be “!=â€, it should be “!==â€. The meaning of
“!=†should really follow the pattern of “op=†(e.g. “+=â€, “*=â€), though in
this case the op is unary. Therefore

!= x;

should really be shorthand for

x = !x;
 
A

Andreas Leitgeb

Lawrence D'Oliveiro said:
OK, so this isn’t specifically a Java thing, but ...
The opposite of “==†shouldn’t be “!=â€, it should be “!==â€. The meaning of
“!=†should really follow the pattern of “op=†(e.g. “+=â€, “*=â€), though in
this case the op is unary. Therefore
!= x;
should really be shorthand for
x = !x;

Does Python have it that way? ;-)
 
B

BGB

OK, so this isn’t specifically a Java thing, but ...

The opposite of “==†shouldn’t be “!=â€, it should be “!==â€. The meaning of
“!=†should really follow the pattern of “op=†(e.g. “+=â€, “*=â€), though in
this case the op is unary. Therefore

!= x;

should really be shorthand for

x = !x;

if one tries to change these little things, they end up with something
almost completely different (in a larger sense). the nature and identity
of programming languages depends very much on these details.

within a given language, one can't change any of things, otherwise they
will have a different language.


now, as for this specific syntax:
it has been established in C-family languages for many decades;
trying to change anything would likely make matters worse than leaving
it the same.


or such...
 
L

Lew

The opposite of “==†shouldn’t be “!=â€, it should be “!==â€. The meaning of

Does Python have it that way? ;-)

Actually, the opposite of "==" really should be whatever the spec says it is.

Gee, "Lawrence", if you're so effing smart shouldn't your language have taken
over the world instead of Java?
 
D

Daniele Futtorovic

OK, so this isn’t specifically a Java thing, but ...

The opposite of “==” shouldn’t be “!=”, it should be “!==”. The meaning of
“!=” should really follow the pattern of “op=” (e.g. “+=”, “*=”), though in
this case the op is unary. Therefore

!= x;

should really be shorthand for

x = !x;

Nonsense! Nature herself teaches, yea, imposes on us that the inverse of
a two-character sequence be the two characters in reverse order.

So the inverse of '==' really ought to be '=='.

I think I'm gonna go troll a Python group and blame them for not
defining it thus.
 
R

Roedy Green

The opposite of “==� shouldn’t be “!=�, it should be “!==�. The meaning of
“!=� should really follow the pattern of “op=� (e.g. “+=�, “*=�), though in
this case the op is unary. Therefore

I too found != ugly when I encountered Java. I would have preferred
the Pascal <>. I too have found the distinction between ~ and ! a
little squishy. ! has no mathematical association with not. It means
factorial. It bugs me when pizza-eating computer types ignore hundreds
of years of mathematical notation.

The only way I can see to fix these sort of problem is to use a SCID,
where what you type and what you see are your business alone, so long
as the deep structure is the same, so other people can type what they
want and see what they want too.
see http://mindprod.com/project/scid.html

For example, an IDE/SCID could display != as Unicode glyph ≠
and <= as the Unicode glyph 0x2264;, maybe white text on red circles.
see http://mindprod.com/jgloss/unicode.html

PS something is wrong with either your newsreader or mine. I am not
seeing the UTF-8 or whatever it is you encoded with.

--
Roedy Green Canadian Mind Products
http://mindprod.com
Refactor early. If you procrastinate, you will have
even more code to adjust based on the faulty design.
..
 
A

Andreas Leitgeb

Roedy Green said:
[mis-interpreted utf8-chars] ...
PS something is wrong with either your newsreader or mine. I am not
seeing the UTF-8 or whatever it is you encoded with.

His post (but not your quote thereof) looked entirely correct
to me, and the headers, too:
< Content-Type: text/plain; charset="UTF-8"
< Content-Transfer-Encoding: 8Bit

The only unusual thing is the quotation marks he used
» « <-- do these look ok to you?
c2 bb c2 ab (the utf-8 encoded octets displayed in hexadecimal)
transcribed in ascii, these would be ">>" and "<<"

Maybe your newsreader is having a hard time with unicode?
 
J

Joshua Cranmer

PS something is wrong with either your newsreader or mine. I am not
seeing the UTF-8 or whatever it is you encoded with.

Your newsreader, apparently. Using your posting newsserver, I do see no
transcoding of the UTF-8, and the output text is in legitimate UTF-8. It
may be that you have some option set to forcibly override the charset to
ISO-8859-1 instead of respecting the charset parameter set in the
Content-Type. The only possible problem I could see is that it has a
Content-Transfer-Encoding of `8Bit', but checking RFC 2045 states that
the value of CTE is case-insensitive, so it can only be a failure of
your program to parse the message correctly.
 
L

Lawrence D'Oliveiro

I too found != ugly when I encountered Java. I would have preferred
the Pascal <>.

Well, some didn’t like that because the “<†and â€>†components seem to
suggest something about ordering, which is a completely separate issue from
(in)equality. That’s why Ada uses “/=â€, being the closest they could get to
“≠†in ASCII.
I too have found the distinction between ~ and ! a little squishy. ! has
no mathematical association with not. It means factorial.

Actually, I don’t have much problem with that. Mathematical notation is full
of inconsistencies I don’t wish to see carried over to computer languages.
For example, “!†meaning factorial is postfix, which is the exception among
unary operators in mathematics.

And then there were all the maths textbooks using “sinâ»Â¹â€ and “cosâ»Â¹â€ for
inverse sin and cos etc. That just drove me up the wall.

But the one major thing I wish C had not popularized is “=†to mean
assignment instead of equality.
 
R

Roedy Green

But the one major thing I wish C had not popularized is “=� to mean
assignment instead of equality.

I think an assignment operator should look like some sort of arrow,
e.g. &lArr; But then I think the target should be on the right, and
the precedence should be simplified so everything works left to right
with traditional mathematical predence for + - * /.

With a SCID I could have things my way, and not need to get permission
from anyone else. They could read my code the way THEY liked.
--
Roedy Green Canadian Mind Products
http://mindprod.com
Refactor early. If you procrastinate, you will have
even more code to adjust based on the faulty design.
..
 
K

Kevin McMurtrie

Lawrence D'Oliveiro said:
OK, so this isn’t specifically a Java thing, but ...

The opposite of “==†shouldn’t be “!=â€, it should be “!==â€. The meaning of
“!=†should really follow the pattern of “op=†(e.g. “+=â€, “*=â€), though in
this case the op is unary. Therefore

!= x;

should really be shorthand for

x = !x;

Shorthand operators need an assignable variable on the left and an
expression on the right. That won't work with a unary operator like NOT.

If you want to talk about consistency:

byte i= 1;
i+= Short.MAX_VALUE;
i+= 'c';
i+= Integer.MAX_VALUE;
i+= Float.NaN;
i+= Float.NEGATIVE_INFINITY;
i+= Double.NaN;
i+= Double.POSITIVE_INFINITY;
i+= Long.MAX_VALUE;
 
A

Andreas Leitgeb

Andreas Leitgeb said:
Roedy Green said:
[mis-interpreted utf8-chars] ...
PS something is wrong with either your newsreader or mine. I am not
seeing the UTF-8 or whatever it is you encoded with.
The only unusual thing is the quotation marks he used

I can't really explain, how, within a few seconds, Lawrence's
quotes “ †morphed into » « quotes in my mind. I apologize, anyway.

The quotes he really used, were (transcribed to ascii): `` and ´´
 
M

Michael Wojcik

Roedy said:
I too found != ugly when I encountered Java. I would have preferred
the Pascal <>. I too have found the distinction between ~ and ! a
little squishy. ! has no mathematical association with not. It means
factorial. It bugs me when pizza-eating computer types ignore hundreds
of years of mathematical notation.

Since the slashed-equals sign isn't in ASCII, it would have been
difficult for them to use the most common mathematical notation.

I'm not sure who introduced "!=". It's in C, obviously. BCPL uses "~="
for the boolean not-equal comparison operator.[1] The question is
whether Ken Thompson used "!=" when he created B based on BCPL, or
Dennis Ritchie did when he created C from B.

I suspect B has "!=", because it appears to use "=" for assignment,
rather than BCPL's ALGOL-like ":=" (which also appears in Pascal,
etc). So it appears to be the instigator of the Great Operator Shift.

I also suspect Ken Thompson has, in fact, eaten pizza.


[1] http://www.cl.cam.ac.uk/~mr10/bcplman.pdf
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top