User: Password:
|
|
Subscribe / Log in / New account

Reitter: Answering the question: "How do I develop an app for GNOME?"

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 6, 2013 6:09 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)
In reply to: Reitter: Answering the question: "How do I develop an app for GNOME?" by FranTaylor
Parent article: Reitter: Answering the question: "How do I develop an app for GNOME?"

Do it with built-in types in Haskell, OCaml or even Java.

Thanks in advance.


(Log in to post comments)

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 6, 2013 15:12 UTC (Wed) by randomguy3 (subscriber, #71063) [Link]

...and you'll find it won't compile. Your examples mostly just made no sense - they worked in an unexpected way because there was really no sane expected behaviour (why should "a" be in any way comparable to 10, for example? What does it mean to add up the contents of a string?).

Not that I don't think that JS is a bit mad in places, or that functional languages aren't a good thing, mind. I just think your examples were somewhat disingenuous.

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 6, 2013 15:37 UTC (Wed) by adobriyan (guest, #30858) [Link]

Examples are fine. It is the programming language which allows both "a <= b" and "b <= a" to be true or false simultaneously is not.

Sane programming languages do not have this property.

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 6, 2013 15:53 UTC (Wed) by mpr22 (subscriber, #60784) [Link]

"a <= b" and "b <= a" being simultaneously true is fine because of the '=' part; I presume you mean that "a < b" and "b < a" being simultaneously true is indicative of a problem (which it is).

On the other hand, "a <= b" and "b <= a" being simultaneously false is sometimes compulsory (IEC 60559 floating point requires that all comparisons involving NaNs, including comparing a NaN to itself, return false.)

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 6, 2013 19:05 UTC (Wed) by JoeBuck (guest, #2330) [Link]

Well, yes; it's OK if < is a partial ordering with incomparible values (there can exist a,b such that neither a<b nor b<a are true).
<p>
But data structures and algorithms that depend on sorting break if there exist a,b,c such that a<b, b<c, and c<a are all true, so warts like this are a significant source of bugs.

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 6, 2013 19:13 UTC (Wed) by drag (subscriber, #31333) [Link]

I am a bit confused about all the above.

Especially the parts about using great-than and less-than to compare strings. Trying to program this way seems broken no matter what the language.

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 7, 2013 9:25 UTC (Thu) by micka (subscriber, #38720) [Link]

There are orders over the strings. One of them is even a total order, and is even understandable and useful (well, for alphabetic ones, it's sometimes a bit hard to generalize to even US-ASCII, and worse for UTF-8+locale), the lexicographic order (the one you learn when one gives you a dictionary).

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 6, 2013 20:34 UTC (Wed) by khim (subscriber, #9252) [Link]

Your examples mostly just made no sense - they worked in an unexpected way because there was really no sane expected behaviour (why should "a" be in any way comparable to 10, for example? What does it mean to add up the contents of a string?).

Of course the examples made no sense! That's exactly the point!

You see, there are statically typed languages (Java, with some limitations C/C++, etc: if you don't use floating point values you are pretty safe there): errors like these will be detected at compile time and you'll fix them before program will be even started for the first time.

There are dynamically typed languages (Lisp, Python, etc): errors like these will be detected at runtime and end-user will see cryptic error message - embarrassing, to be sure, but not the end of the world.

And finally there are languages like PHP or JavaScript: errors like these will be detected when your applications it cracked and is happily sending spam all over the internet (or, alternatively, when your credit card info is stolen and your account is emptied).

Yes, JavaScript [...] [is] surprisingly good considering the speed at which it was created, I fully agree. It's still a crazy language which would never be used for anything serious in a better world. In our world it must be avoided as much as possible: there are cases where you are forced to use it, but there are no need to propagate this insanity further then necessary.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds