Not Equals

Please compose all posts in Emacs.

Moderators: phlip, Moderators General, Prelates

Which do you prefer?

!=
161
76%
~=
2
1%
/=
5
2%
=/=
20
9%
<>
8
4%
Platypus
15
7%
 
Total votes: 211

tkbx
Posts: 0
Joined: Wed Sep 26, 2012 12:22 am UTC

Re: Not Equals

Postby tkbx » Sat Sep 29, 2012 10:23 pm UTC

≠ seems most logical, =/= if ≠ isn't supported, but != works fine.

Роберт
Posts: 4285
Joined: Wed May 14, 2008 1:56 am UTC

Re: Not Equals

Postby Роберт » Tue Oct 09, 2012 10:56 pm UTC

tkbx wrote:≠ seems most logical, =/= if ≠ isn't supported, but != works fine.

how the heck do you expect people even to type that? Surely that crossed your brain...
The Great Hippo wrote:[T]he way we treat suspected terrorists genuinely terrifies me.

EvanED
Posts: 4327
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Not Equals

Postby EvanED » Tue Oct 09, 2012 11:35 pm UTC

Роберт wrote:
tkbx wrote:≠ seems most logical, =/= if ≠ isn't supported, but != works fine.

how the heck do you expect people even to type that? Surely that crossed your brain...

It wouldn't be totally unreasonable to "require" editor support. For instance, you could enter != and the editor would change it to ≠. Now, that said: it'd probably be more better to have an editor mode that would just render occurrences of != as ≠, and then you get both nice-looking source as well as a more traditional backing format.

...Actually, I kind of want this now. :-) Anyone know an Emacs mode that will let me do stuff like that? Preferably a customizable list of replacements?

User avatar
AvatarIII
Posts: 2098
Joined: Fri Apr 08, 2011 12:28 pm UTC
Location: W.Sussex, UK

Re: Not Equals

Postby AvatarIII » Wed Oct 10, 2012 10:16 am UTC

my preference is
=/= for ≠
~= for ≈
and
== for ≡

troyp
Posts: 557
Joined: Thu May 22, 2008 9:20 pm UTC
Location: Lismore, NSW

Re: Not Equals

Postby troyp » Wed Oct 10, 2012 10:31 pm UTC

EvanED wrote:...Actually, I kind of want this now. :-) Anyone know an Emacs mode that will let me do stuff like that? Preferably a customizable list of replacements?

You could use the standard "autocorrection" features of any editor, like Emacs' abbrev mode. I don't approve of autocorrecting spelling (it probably just makes people's spelling worse), but dynamic abbreviations have legitimate uses, like this. If you don't want it to be automatic, there are also "snippets" modes like Yasnippet that would work.

EvanED
Posts: 4327
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Not Equals

Postby EvanED » Wed Oct 10, 2012 10:57 pm UTC

troyp wrote:
EvanED wrote:...Actually, I kind of want this now. :-) Anyone know an Emacs mode that will let me do stuff like that? Preferably a customizable list of replacements?

You could use the standard "autocorrection" features of any editor, like Emacs' abbrev mode. I don't approve of autocorrecting spelling (it probably just makes people's spelling worse), but dynamic abbreviations have legitimate uses, like this. If you don't want it to be automatic, there are also "snippets" modes like Yasnippet that would work.

Ah, but the problem is I need the "expanded" form rewritten back to the "abbreviation" form when it saves... e.g. an abbreviation that will "expand" != to isn't helpful if it just leaves the ≠ in place when it saves. This is more like what I'm after, though I haven't tried anything from it yet.

troyp
Posts: 557
Joined: Thu May 22, 2008 9:20 pm UTC
Location: Lismore, NSW

Re: Not Equals

Postby troyp » Thu Oct 11, 2012 1:59 am UTC

EvanED wrote:Ah, but the problem is I need the "expanded" form rewritten back to the "abbreviation" form when it saves... e.g. an abbreviation that will "expand" != to isn't helpful if it just leaves the ≠ in place when it saves. This is more like what I'm after, though I haven't tried anything from it yet.

Yeah, of course, sorry. Reading the last couple of comments had me thinking in terms of character entry and I completely lost sight of the bigger picture. Which is strange because (a) I was surprised you seemed to be asking about something as well-known as dynamic abbrev, and (b) I've actually wanted this exact feature myself.

I'd actually love a more general "invertible* transform" minor mode, not only for this, but for other purposes. I think you could use it in many ways to make code more readable and even for simple code generation. eg. "pretty lambdas", code folding, box comments, etc, are all instances of this. It'd be nice to have a convenient common framework to create such tools.

I've been meaning to learn my way around the Emacs API for ages. I often think of things I want to do in Emacs, but I only ever implement simple functions because I have to turn to Google for every little thing since I don't know the basics (unless I can get function names from C-h k or something).

Coming back to the topic somewhat, I'm surprised more editors/IDEs don't offer "prettified" math syntax, like a proper not-equals sign, multiplication sign, superscripts and subscripts for exponents and log bases, etc (as well as non-math prettifications like box comments and conversion of ASCII headings into a larger heading font). Dr Racket does pretty lambdas and box comments (and I think a few other editors do as well), but nobody seems to take it much further.

* really, I mean homomorphic, not just invertible - ie. you could make changes to the transformed view and have them translate predictably to changes in the original view.

Derek
Posts: 2155
Joined: Wed Aug 18, 2010 4:15 am UTC

Re: Not Equals

Postby Derek » Thu Oct 11, 2012 6:04 am UTC

troyp wrote:Coming back to the topic somewhat, I'm surprised more editors/IDEs don't offer "prettified" math syntax, like a...conversion of ASCII headings into a larger heading font)...

Source Insight does something like this. More specifically, it takes the idea of syntax highlighting and extends it to basically arbitrary font control, so you can not only change the color of the text, but also the font, size, etc. So you can make class declarations really big to make them easy to pick out.

User avatar
Xenomortis
Not actually a special flower.
Posts: 1397
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Not Equals

Postby Xenomortis » Thu Oct 11, 2012 9:09 am UTC

Grimgar wrote:<> is terrible, because it is read as "is less than or greater than", which is NOT equivalent to "is not equal to", unless you're working with a totally ordered set.


But the Axiom of Choice is obviously true.

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Thu Oct 11, 2012 12:44 pm UTC

Derek wrote:
troyp wrote:Coming back to the topic somewhat, I'm surprised more editors/IDEs don't offer "prettified" math syntax, like a...conversion of ASCII headings into a larger heading font)...

Source Insight does something like this. More specifically, it takes the idea of syntax highlighting and extends it to basically arbitrary font control, so you can not only change the color of the text, but also the font, size, etc. So you can make class declarations really big to make them easy to pick out.


Source Insight is great. I really wish there was something like it for Mac (know of anything?)

User avatar
hotaru
Posts: 1025
Joined: Fri Apr 13, 2007 6:54 pm UTC

Re: Not Equals

Postby hotaru » Thu Oct 11, 2012 4:43 pm UTC

EvanED wrote:Ah, but the problem is I need the "expanded" form rewritten back to the "abbreviation" form when it saves... e.g. an abbreviation that will "expand" != to isn't helpful if it just leaves the ≠ in place when it saves. This is more like what I'm after, though I haven't tried anything from it yet.

There's also the possibility of doing something like fixedsys excelsior's "zzcodes"...

Code: Select all

factorial product enumFromTo 1
isPrime n 
factorial (1) `mod== 1

User avatar
mathmannix
Posts: 1401
Joined: Fri Jul 06, 2012 2:12 pm UTC
Location: Washington, DC

Re: Not Equals

Postby mathmannix » Wed Aug 21, 2013 12:52 pm UTC

I didn't vote, because the best format for this operator is clearly "ne", which wasn't one of the given options.
I hear velociraptor tastes like chicken.

alessandro95
Posts: 109
Joined: Wed Apr 24, 2013 1:33 am UTC

Re: Not Equals

Postby alessandro95 » Mon Sep 02, 2013 6:32 am UTC

Looks like I'm the only one who voted for ~=, I guess nobody else on this board programs a lot in Lua :D
The primary reason Bourbaki stopped writing books was the realization that Lang was one single person.

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Mon Sep 02, 2013 1:50 pm UTC

I actually used to program in a language that used ≠

In early versions, it was entered by pressing the ESC key followed by the = key. In later versions, it was entered by pressing = modified by the ALT/meta/option key.

That language also used ≤ and ≥ with the meanings one would expect, ⇐ for assignment and ⋮ as a delimiter. Brackets vaguely like 【 and 】 were used to embed variables in strings.

There was no problem entering any of them, but yeah, you needed an editor designed to support the language.

(And I'm curious if anyone else recognizes what language I'm talking about...it was rather obscure)

User avatar
Yakk
Poster with most posts but no title.
Posts: 11053
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Not Equals

Postby Yakk » Mon Sep 02, 2013 6:32 pm UTC

APL I presume?
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Mon Sep 02, 2013 7:10 pm UTC

Yakk wrote:APL I presume?

A good guess, but no. APL's assignment operator is ←, not ⇐.

And as far as I know, APL doesn't have syntax for embedding variables directly in strings*

A bit more obscure than APL, I think.

* This is something like "User 【a,name】 is 【n,age】 years old" which is roughly equivalent to PHP's "User $name is $age years old" syntax.

dii
Posts: 164
Joined: Fri Feb 22, 2013 2:42 am UTC
Location: 60.17°N 24.94°E

Re: Not Equals

Postby dii » Fri Sep 20, 2013 8:38 pm UTC

<> is nostalgic because it brings to mind such classics from my youth as C-64 system basic, GWbasic and Borland Pascal.

I'd still have to go with !=, as it's the most logical and easiest to type on a scandinavian keyboard.

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Sat Sep 21, 2013 6:42 pm UTC

dii wrote:<> is nostalgic because it brings to mind such classics from my youth as C-64 system basic, GWbasic and Borland Pascal.

I'd still have to go with !=, as it's the most logical and easiest to type on a scandinavian keyboard.


What makes != logical, other than familiarity?

Sure, in many languages ! is the logical-not operator. But consider:

+=
-=
/=
*=

...does != fit this pattern? I think not. That said, ! is a unary operator, so using it differently isn't necessarily bad. And maybe there's no better choice. But...I'm not sure I'd go so far as to call it logical.

dii
Posts: 164
Joined: Fri Feb 22, 2013 2:42 am UTC
Location: 60.17°N 24.94°E

Re: Not Equals

Postby dii » Sat Sep 21, 2013 7:20 pm UTC

WanderingLinguist wrote:
dii wrote:<> is nostalgic because it brings to mind such classics from my youth as C-64 system basic, GWbasic and Borland Pascal.

I'd still have to go with !=, as it's the most logical and easiest to type on a scandinavian keyboard.


What makes != logical, other than familiarity?

Sure, in many languages ! is the logical-not operator. But consider:

+=
-=
/=
*=

...does != fit this pattern? I think not. That said, ! is a unary operator, so using it differently isn't necessarily bad. And maybe there's no better choice. But...I'm not sure I'd go so far as to call it logical.


Ah, but consider also:

<=
>=
==

Does != fit this pattern? I think yes, Perfectly. Lesser/equal, greater/equal, equal equal, and... not equal. I think it's the perfect way to mark "not equal": ! already means "not", = already means "equal", so putting them next to each other yields... "not equal".

It also doesn't really make sense to compare != to +=, -= etc. because those are combination assignment/arithmetic operators. != doesn't need to be consistent with them, it only needs to be consistent with the other evaluative operators.

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Sat Sep 21, 2013 10:58 pm UTC

dii wrote:
Ah, but consider also:

<=
>=
==

Does != fit this pattern? I think yes, Perfectly. Lesser/equal, greater/equal, equal equal, and... not equal. I think it's the perfect way to mark "not equal": ! already means "not", = already means "equal", so putting them next to each other yields... "not equal".

It also doesn't really make sense to compare != to +=, -= etc. because those are combination assignment/arithmetic operators. != doesn't need to be consistent with them, it only needs to be consistent with the other evaluative operators.


Errm, <= is "less or equal". So does that make != "not or equal"? Again, I'm not saying there's anything with using != as "not equal", I'm just saying that it doesn't make sense to argue that it's "logical". Unless you are using "logical" to mean something like "sensible" or "intuitive" or "obvious". In which case, you could argue it, but I'd disagree ;-)

dii
Posts: 164
Joined: Fri Feb 22, 2013 2:42 am UTC
Location: 60.17°N 24.94°E

Re: Not Equals

Postby dii » Sun Sep 22, 2013 9:10 am UTC

WanderingLinguist wrote:
dii wrote:
Ah, but consider also:

<=
>=
==

Does != fit this pattern? I think yes, Perfectly. Lesser/equal, greater/equal, equal equal, and... not equal. I think it's the perfect way to mark "not equal": ! already means "not", = already means "equal", so putting them next to each other yields... "not equal".

It also doesn't really make sense to compare != to +=, -= etc. because those are combination assignment/arithmetic operators. != doesn't need to be consistent with them, it only needs to be consistent with the other evaluative operators.


Errm, <= is "less or equal". So does that make != "not or equal"? Again, I'm not saying there's anything with using != as "not equal", I'm just saying that it doesn't make sense to argue that it's "logical". Unless you are using "logical" to mean something like "sensible" or "intuitive" or "obvious". In which case, you could argue it, but I'd disagree ;-)


Now you're just getting stuck on the semantics. It's the symbolic language that counts. <= has two symbols, "less" and "equal", combined they form "less or equal". != has two symbols, "not" and "equal", combined they form "not equal". The "or" is only inferred by common sense, because there's no such thing as "less equal". Therefore it's still logical.

log·i·cal
[loj-i-kuhl]
adjective
1. according to or agreeing with the principles of logic: a logical inference.
2. reasoning in accordance with the principles of logic, as a person or the mind: logical thinking.
3. reasonable; to be expected: War was the logical consequence of such threats.
4. of or pertaining to logic.

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Sun Sep 22, 2013 6:09 pm UTC

Well, being that this is Religious Wars, I can't just let it go at that, can I? ;-)

It's a matter of perspective, I think. What's reasonable or logical for you may not be reasonable or logical for someone else.

Having taught quite a few people how to program in languages that use these sort of operators, my observation has been that the compound operators involving "=" quite often lead to some confusion at first.

And if you're a veteran programmer, well, you don't really care what's "reasonable" or "expected" in this particular case because this use of != is so common that it feels reasonable to those of us who have been using it for a while (over 20 years in my case). So yeah, it feels reasonable to me, but I'm arguing that it's not ;-)

The problem with people who are just getting started is that they don't know the full set of operators yet. So they might not know that ! is logical-not (for some people, understanding not-equals is easier that understanding logical-not). They might also not know about operators like >= <= += -= or the like. In the beginning, someone struggling with the basic concepts of programming has enough to worry about without having memorized all the operators in a given language. One student was under the misconception that != meant "very equal" or "identical", seeing the ! as emphasis.

So what's logical or expected depends on where you're coming from.

Of course, there are plenty of practical reasons why we're stuck with ASCII now, and I guess != may be the best choice simply because it's so widely known and understood across a wide range of programming languages (and not quite as evil as <>). Nevertheless, part of me feels like it's just too bad that standard keyboards (and the ASCII standard) didn't include the ≠ ≤ ≥ and ⇐ characters. They could have done; we have characters like the piping symbol and backslash, after all, and a few control codes could have been sacrificed. Then we make & and | logical-and and logical-or, and leave double-character operators for things that aren't as widely used or that are used for convenience, such as += and so on. I think this would have been a more elegant solution (and one of my first two programming languages -- the other was BASIC -- did it like this).

Alas, now it makes more sense to use what programmers are familiar with rather than inventing something new. So we're stuck with != and the evil of = being assignment. But just because it's familiar to people who've been using it for years doesn't necessarily make it "logical". That's the point I was trying to make ;-)

dii
Posts: 164
Joined: Fri Feb 22, 2013 2:42 am UTC
Location: 60.17°N 24.94°E

Re: Not Equals

Postby dii » Sun Sep 22, 2013 7:37 pm UTC

WanderingLinguist wrote:Well, being that this is Religious Wars, I can't just let it go at that, can I? ;-)


You could, but you don't have to if you don't want.

WanderingLinguist wrote:And if you're a veteran programmer


I'm a veteran amateur programmer. I've done coding as a casual hobby for quite a while, but never really invested into learning any one language well enough to do any kind of serious coding. I like to code small programs and snippets now and then, but it's not something I'd want to do as a profession.

My problem is, I always get excited about a new language, learn enough of it to do some simple stuff, but then I get bored or find a new language to jump into... Not Lisp or any of its derivatives though, I just (can't (stand ((the) syntax...))) (but I digress)

WanderingLinguist wrote:Having taught quite a few people how to program in languages that use these sort of operators, my observation has been that the compound operators involving "=" quite often lead to some confusion at first.

And if you're a veteran programmer, well, you don't really care what's "reasonable" or "expected" in this particular case because this use of != is so common that it feels reasonable to those of us who have been using it for a while (over 20 years in my case). So yeah, it feels reasonable to me, but I'm arguing that it's not ;-)


Oh? I think the only confusing part about = operators when you're new is the differentiation of == for evaluation and = for assignment. Once you clear that hurdle, ie. understand the distinction between assignment and evaluation, I feel <=, >= and != all come naturally.

WanderingLinguist wrote: One student was under the misconception that != meant "very equal" or "identical", seeing the ! as emphasis.


Yes but of course nothing makes sense out of context. If you don't know the symbol vocabulary, then none of them really mean anything to you. But once you do know all the symbols, they start making sense, because it has internal consistency.

But let's look at the alternatives. The best reason to use != is that all the alternatives are worse.

/= and =/= are clearly meant as imitations of the "real" not-equal sign, but they are poor imitations at best. The first one looks too much like an emoticon, it is also often reserved for division-assignment, and the second one is cumbersome and ugly, too long.

<> is problematic because it seems to imply "less or greater than".

WanderingLinguist wrote:So we're stuck with != and the evil of = being assignment.


I don't think there's necessarily anything evil about = being assingment. It's very logical, if you consider every assignment as an imperative statement: a = b would read as "let a equal b".

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Sun Sep 22, 2013 9:33 pm UTC

dii wrote:But let's look at the alternatives. The best reason to use != is that all the alternatives are worse.


Well, yes, that's what I was said, more or less.

But I would qualify it like this:

The best reason to use != is that all the alternatives are worse now.

My point being, ≠ would have been a much more logical choice in the beginning. Back then, ASCII had only just been published and was still undergoing revisions; it could have been possible to choose a special character like ≠ (after all, | and \ are not normal characters on a typewriter keyboard, and yet they became standard in ASCII and on most computer keyboards -- granted, \ is substituted with currency symbols in some keyboard layouts -- but that's a separate issue).

It doesn't make sense to add new characters now. With UTF8, it would actually be doable, but it would be impractical because they would require special IDE or text editor or IME support (inconvenient to work with existing tools). That, and people are already familiar with != as an operator.

So now, yes, != makes the most sense now. But I don't think it was the most logical choice when the decision was originally made. It's only logical because we're stuck with it (current viable alternatives are no better), but "logical" doesn't really seem a nice description of it. "Unavoidable" perhaps.

dii
Posts: 164
Joined: Fri Feb 22, 2013 2:42 am UTC
Location: 60.17°N 24.94°E

Re: Not Equals

Postby dii » Sun Sep 22, 2013 10:11 pm UTC

WanderingLinguist wrote:So now, yes, != makes the most sense now. But I don't think it was the most logical choice when the decision was originally made.


Actually that only applies if the people who designed the language were the same people who designed ASCII. If the people responsible for the language had no choice to choose what symbols were chosen for ASCII, then they had to work with what they had, and thus != was the best and most logical choice they could make.

lalop
Posts: 210
Joined: Mon May 23, 2011 5:29 pm UTC

Re: Not Equals

Postby lalop » Mon Sep 23, 2013 1:32 am UTC

Is it really necessary/particularly desirable to require the language be expressible in ASCII? Most text editors I know seem to support unicode. Characters like ≠ can be added as AltGr keys to a keyboard layout, or just shortcutted into the more programming-oriented editors.

Sure, it breaks backward-compatibility, but we already live in a world where we're expected to use bloated IDEs to compensate for the deficiencies of a language. This is, by comparison, a minor requirement.

dii
Posts: 164
Joined: Fri Feb 22, 2013 2:42 am UTC
Location: 60.17°N 24.94°E

Re: Not Equals

Postby dii » Mon Sep 23, 2013 2:34 am UTC

lalop wrote:Is it really necessary/particularly desirable to require the language be expressible in ASCII? Most text editors I know seem to support unicode. Characters like ≠ can be added as AltGr keys to a keyboard layout, or just shortcutted into the more programming-oriented editors.

Sure, it breaks backward-compatibility, but we already live in a world where we're expected to use bloated IDEs to compensate for the deficiencies of a language. This is, by comparison, a minor requirement.


Well, no, there isn't really any reason other than convention. In order to conveniently edit source code, editors are already required to recognize the language syntax to be able to apply pretty colours properly. So it'd just be another requirement to the editors: in order to support (convenient editing of) language X, the editor must allow easy input of certain special characters.

Also, depends on language, as some languages may need to be able to work on minimal CLI-only platforms that lack Unicode support... I can't really think any examples, but I'm sure some exist though at least probably maybe.

But that's a minor concern. In fact, we should take this idea further, and design a language that would utilize not only Unicode, but rich text formatting as well. Instead of quotes, strings could be be marked by writing the text in italic. Comments could be marked by super. Bold could signify constants, pointers could be underlined, etc...

print hello world;
int z;
int x; this is a pointer
x ⇐ z; now x points to z
Pi ⇐ 3.14; defining a constant

User avatar
sparkyb
Posts: 1091
Joined: Thu Sep 06, 2007 7:30 pm UTC
Location: Camberville proper!
Contact:

Re: Not Equals

Postby sparkyb » Mon Sep 23, 2013 12:54 pm UTC

dii wrote:π ⇐ 3.14; defining a constant


FTFY

User avatar
Copper Bezel
Posts: 2416
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

Re: Not Equals

Postby Copper Bezel » Mon Sep 23, 2013 1:51 pm UTC

It hurts how much that actually does look readable to me, as a non-coder, such that I want to learn that hypothetical language....
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

User avatar
Xenomortis
Not actually a special flower.
Posts: 1397
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Not Equals

Postby Xenomortis » Mon Sep 23, 2013 2:03 pm UTC

On the other hand, it looks terrible to me. It'd be a nightmare to type and doesn't really seem more readable.
And I don't see how this:

int x;
x ⇐ z;
is inherently more readable than

int * x;
x = & z;

Information density is basically unchanged, as is visual clutter. But important information is hidden in styling in the former; the latter is more explicit.
Oh, and it'd clash with editor styling. For instance, I have Visual Studio set to make all numbers bold (and given a red tint).
I guess the comments are more obvious before editor styling kicks.
Image

User avatar
Copper Bezel
Posts: 2416
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

Re: Not Equals

Postby Copper Bezel » Mon Sep 23, 2013 4:25 pm UTC

I don't think dii was serious - it's supposed to be a terrible idea. Again, I don't code, and as an English instructor, I'm used to seeing superscript or italics as having semantic meaning about the strings they contain, while thinking of Ctrl+* keystrokes to trigger them as being a natural part of typing. The markup in the real code looks as artificial to me as using *this* in place of this. Superscript comments and assignment arrows and bold, italics, or underline to class kinds of objects have automatic, transparent meaning to me. That doesn't make them good, just incidentally familiar.

And yes, technically, underline and italics were once considered equivalent, before someone jumps on the English thing to get pedantic. They're typographically as distinct as any other formatting choice.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

dii
Posts: 164
Joined: Fri Feb 22, 2013 2:42 am UTC
Location: 60.17°N 24.94°E

Re: Not Equals

Postby dii » Tue Sep 24, 2013 12:44 am UTC

I was semi-serious. I don't think it'd be something that would revolutionize coding, or even a particularly great idea. But it'd be an interesting experiment, and there are worse concepts to base programming languages on. After all, I'm sure the world could survive without Brainfuck...

User avatar
Copper Bezel
Posts: 2416
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

Re: Not Equals

Postby Copper Bezel » Tue Sep 24, 2013 2:13 am UTC

In that case, somebody fund this. = ) (Linux-friendly, if you would, although I suppose that's assumed for most IDEs to begin with.)
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

User avatar
WanderingLinguist
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: Not Equals

Postby WanderingLinguist » Tue Sep 24, 2013 9:49 pm UTC

The problem with special characters is not that Unicode doesn't include support for them, but rather than they are not supported standard in modern editors: You have to assign a keyboard shortcut, and keyboard shortcuts are a precious limited resource (have you SEEN the keyboard mappings for modern IDEs?) But a bigger issue is that most fixed-pitch fonts used for source code display aren't going to include the special characters, so you end up with font substitution, which can look ugly, break indentation, etc. None of these are insurmountable problems, but they do make it rather inconvenient to try to build a language with special characters.

As for styling: As Xenomortis said, it would clash with editor styling. Editor styling is incredibly useful, and it would be a huge loss not to have it. Styling should reflect semantic meaning rather than carry semantic meaning, in my opinion. Also, the type of styling that could be used would be pretty limited: Bold, italic, and underline. Assigning semantic value to color would be a problem for people who are color-blind. And even Italic has issues. For example, let's say the language uses italic to indicate literal strings (this is a terrible idea, I'm not suggesting it), then what is this?

|\


Is it a forward slash followed by a vertical bar? Or is it vertical bar followed by a backslash, in italics?

And some special character don't have good-looking bold versions. So it pretty much limits you to underline. But colored underlines (particularly red and yellow) are already used to indicate errors and warnings in many IDEs.

So I think its better to leave styling alone.

dii wrote:Actually that only applies if the people who designed the language were the same people who designed ASCII. If the people responsible for the language had no choice to choose what symbols were chosen for ASCII, then they had to work with what they had, and thus != was the best and most logical choice they could make.


Errm, lots of programming languages used non-ASCII characters back then (APL anyone?) There were also multiple standards (ASCII wasn't the only one) and the standards were very recent (just a year or two old and still undergoing revision, and in fact the final revision of ASCII that we used today was published many years *after* the first version of C). So the decision of which characters to use did not necessarily have to be limited to confirm to pure ASCII at the time.

Sorry, I guess I just can't leave the "it's logical" thing alone -- we have plenty of symbols in mathematics for expressing concisely concepts that we express verbosely in programming languages due to early technical limitations (7-bit character sets, etc.). But aren't those symbols the most logical? After all, they are already standard in mathematics. And actually, I've even seen books where pseudocode examples were written using ≠ rather than != or the other alternatives that have been mentioned. Because it's standard and people know what it means (as opposed to, say, != which Visual Basic programmers might not recognize).

lalop
Posts: 210
Joined: Mon May 23, 2011 5:29 pm UTC

Re: Not Equals

Postby lalop » Wed Sep 25, 2013 8:10 am UTC

You could also use a snippet, which admittedly defeats half of the purpose if you have to type something like != anyway, but at least readability would be increased.

This wouldn't work so well for the rtf proposal, probably. Then again, it would be cool to see vim with them as text objects, e.g. cii (change inside italics?).

Grimbal
Posts: 0
Joined: Sun Sep 28, 2014 12:22 am UTC

Re: Not Equals

Postby Grimbal » Sun Sep 28, 2014 12:37 am UTC

! suggests the imperative. A reinforcement. Certainty.
The combination of ! with = looks like "certainly equal". ?= would be "maybe equal". And of course, ~= would be "approximately equal".
All not good.

Besides, x += 2 means x = x+2, so != looks like a negation-and-assignment. "x !=" and "!= x" suggest x = !x, (as prefix or suffix like x++ and ++x).

In short, I grew up with <> and it's the only one that looks right to me.

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: Not Equals

Postby ahammel » Sun Sep 28, 2014 2:36 pm UTC

Grimbal wrote:In short, I grew up with <> and it's the only one that looks right to me.
Perhaps it looks right, but it's wrong when comparing types that aren't well-ordered.
He/Him/His/Alex
God damn these electric sex pants!

Grimbal
Posts: 0
Joined: Sun Sep 28, 2014 12:22 am UTC

Re: Not Equals

Postby Grimbal » Wed Oct 01, 2014 7:02 pm UTC

Whether it is wrong depends on the language. You can argue that it is not logical though.

Nyktos
Posts: 138
Joined: Mon Mar 02, 2009 4:02 pm UTC

Re: Not Equals

Postby Nyktos » Fri Oct 03, 2014 6:41 pm UTC

Anything other than ≠ is wrong. The rightness of alternatives is measured by how similar they are to ≠. By this metric, <> is extremely wrong.

User avatar
Flumble
Yes Man
Posts: 1951
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: Not Equals

Postby Flumble » Fri Oct 03, 2014 7:06 pm UTC

Why is <> mentioned but not ><?
>< looks like a cross (×) which signifies not-ness. And it looks like an annoyed emoticon, so you can use it for types lacking order.


Return to “Religious Wars”

Who is online

Users browsing this forum: No registered users and 3 guests