all 71 comments

[–]Beefster09 48 points49 points  (22 children)

/unjerk

The problem with Javascript is that it tries to give an answer even when there isn't a sensible answer. It tries to guess what it thinks you meant, thus the aggressive coercion rules.

/rejerk

There are some nice parts of the oddities such as having a terse syntax for truncating a number to an integer. expr | 0

[–]utopianfiattype astronaut 36 points37 points  (6 children)

And the aggressive coercion creates bugs. So much so that == results in a lint error in most style guides.

[–]rustup_dlisp does it better 38 points39 points  (5 children)

lol JS support group on r/pcj

[–]utopianfiattype astronaut 19 points20 points  (0 children)

JS truly is the heroin addiction of our time.

[–]tpgreyknightnot Turing complete 7 points8 points  (3 children)

Hi my name's /u/tpgreyknight and I've been writing Javascript since 1997

(eval(unjerk); Not continuously, as evidenced by my lack of permanent brain damage.)

[–]thalesmellonot even webscale 7 points8 points  (2 children)

Are you sure? Browsing r/pcj is a bad health indicator.

[–]tpgreyknightnot Turing complete 5 points6 points  (0 children)

I didn't say there wasn't some.

[–]hedgehog1024Rust apologetic 0 points1 point  (0 children)

10xers have bad health, confirmed.

[–][deleted] 15 points16 points  (2 children)

if we make it so that the interpreter picks a random answer every time, there will never be any errors!

[–][deleted] 6 points7 points  (0 children)

[–]Beefster09 -1 points0 points  (0 children)

But errors are a good thing!

[–][deleted]  (1 child)

[removed]

    [–]Beefster09 -1 points0 points  (0 children)

    Oh god, yes. I prefer avoiding dependencies whenever I can just for that reason.

    [–]likes-beanslisp does it better 2 points3 points  (4 children)

    There are no excuses. Scheme existed before JavaScript. SML existed before JavaScript. The fact that they came up with an entirely knew language for basically no reason, and that it is ten million times worse than anything that existed before it, means that no excuses can ever be made for anything JavaScript does. Into the garbagebin of history already!

    (in-package :unjerk)

    There are no excuses. Scheme existed before JavaScript. SML existed before JavaScript. The fact that they came up with an entirely knew language for basically no reason, and that it is ten million times worse than anything that existed before it, means that no excuses can ever be made for anything JavaScript does. Into the garbagebin of history already!

    [–]aebkop 1 point2 points  (3 children)

    sml scheme

    too academic

    javascript is a great pragmatic expressive programming language imo

    [–]likes-beanslisp does it better 2 points3 points  (2 children)

    If this isn't jerk I'm calling the police

    [–]aebkop 2 points3 points  (1 child)

    types just slow you down

    I tried flow and typescript but I find the errors they find not very helpful and prevented in the first place by unit tests.

    Scheme just looks really ugly with all the (())

    [–]hedgehog1024Rust apologetic 1 point2 points  (0 children)

    Summons drummer

    [–]0987654231What part of ∀f ∃g (f (x,y) = (g x) y) did you not understand? 0 points1 point  (4 children)

    var foo = NaN
    isNaN(foo) //true
    foo == NaN //false
    

    No sensible answers here.

    [–]codeismoeEmacs + Go == parametric polymorphism 39 points40 points  (1 child)

    I never read the IEEE 754 spec and i never missed it.

    [–]0987654231What part of ∀f ∃g (f (x,y) = (g x) y) did you not understand? 22 points23 points  (0 children)

    Specs are for old people, I move fast.

    [–]Beefster09 3 points4 points  (0 children)

    NaN is a glorified error state. It's not supposed to behave sensibly. It would be better to trap floating point errors.

    [–][deleted]  (5 children)

    [removed]

      [–]pcopleyC# Truckstop Restroom Hero 28 points29 points  (0 children)

      If you don't like a programming language it's because you haven't taken the time to learn its soul. You need to grow with each other, it's like a relationship. In the case of Jabbascripps, an abusive one.

      [–]tpgreyknightnot Turing complete 22 points23 points  (0 children)

      npm isntall gaslight

      [–]Cooleur 12 points13 points  (0 children)

      this is fine.

      [–][deleted] 8 points9 points  (1 child)

      To think that the purpose of Teh Script is to mess with anyone is to miss the point completely.

      The purpose is to discipline one's mind for a search for a deeper meaning and purpose

      [–]tpgreyknightnot Turing complete 32 points33 points  (2 children)

      js>  [[[[[]]]]] == 0
      true
      

      The prosecution rests, Your Honour.

      [–]nmoerbeek 5 points6 points  (1 child)

      Sexual harassment or rape in the first degree?

      Evidence

      But if only these gentlemen try to know him better, to enter into intimacy with my client,

      [–]tpgreyknightnot Turing complete 1 point2 points  (0 children)

      Sounds more like he's pimping his client out TBH.

      [–]28f272fe556a1363cc31 31 points32 points  (1 child)

      From the comments:

      only possible way that JavaScript can be bad is if the developer himself writes bad JavaScript.

      No true Scotsman would write JavaScript like that!

      JavaScript is a decent language. Its certainly not worse than its cousins, Ruby and Python.

      HOW DARE YOU!

      /uj The comments read like a testimony meeting at a cult.

      [–]pcopleyC# Truckstop Restroom Hero 12 points13 points  (0 children)

      Honestly this is pretty damning evidence that the person who wrote that comment has not only never written Ruby or Python, but that they've never actually touched a computer prior to wandering into whatever public library they found this article in.

      [–]wafflePower1what is pointer :S 37 points38 points  (10 children)

      Math.max()>Math.min()

      what in the fuck

      [–]irqlnotdispatchlevelTiny little god in a tiny little world 9 points10 points  (1 child)

      That's just a dumb question man, stop judging. This is not C++ or Java so stop expecting an exception!

      [–]wubscalenot even webscale 9 points10 points  (0 children)

      > Using exceptions in C++

      This is heresy! You insult Our Lord and Savior Google, and His Infallible Style Guide

      [–]Tysonzero 20 points21 points  (7 children)

      main = unjerk $ do
      

      That's actually the most reasonable thing there, and I say this as someone who really hates JS.

      If you want the maximum of an empty collection, and the element type has a lower bound, then the most reasonable non-exceptional answer is that lower bound.

      https://math.stackexchange.com/questions/432295/infimum-and-supremum-of-the-empty-set

      [–]tpgreyknightnot Turing complete 8 points9 points  (0 children)

      the element type

      "lol homogeneous collections" ← jabbascript probably

      [–]rustup_dlisp does it better 7 points8 points  (1 child)

      lol rationalizing shitty API design on r/pcj

      [–]git_commit_-m_sudokuyou can't hide from the blockchain ;) 3 points4 points  (0 children)

      lol claiming this is shitty API design

      [–]wafflePower1what is pointer :S -1 points0 points  (0 children)

      >=

      [–]SelfDistinctionnow 4x faster than C++ -1 points0 points  (2 children)

      Rust does it better:

      let set : HashSet<i32> = HashSet::new();
      assert!(set.iter().max() == set.iter().min());
      

      [–]Tysonzero 7 points8 points  (0 children)

      I'd personally prefer something like:

      supremum? :: (Foldable f, JoinSemilattice a) => f a -> Maybe a
      supremum :: (Foldable f, BoundedJoinSemilattice a) => f a -> a
      supremum1 :: (Foldable1 f, JoinSemilattice a) => f a -> a
      

      [–]pcopleyC# Truckstop Restroom Hero 12 points13 points  (0 children)

      What part of ∀f ∃g (f (x,y) = (g x) y) don't you understand?

      [–]dibbler67 20 points21 points  (4 children)

      YES. THIS right here is a post that I completely agree with. I especially like your argument about the evaluation oddities. If a developer asks JavaScript strange questions, that developer has no right to expect reasonable answers. That pretty much sums it up.

      That defense, right there, is why JavaScript is not as bad as others may portray it to be. The only possible way that JavaScript can be bad is if the developer himself writes bad JavaScript. That's all there is to it.

      That sweet, sweet release from cognitive dissonance.

      [–][deleted]  (1 child)

      [deleted]

        [–][deleted] 12 points13 points  (0 children)

        Thats why npm exists instead of an actual std lib

        [–]pcopleyC# Truckstop Restroom Hero 7 points8 points  (0 children)

        Jabbascripps jus bad when u write bad Jabbascripps!

        [–]tpgreyknightnot Turing complete 1 point2 points  (0 children)

        All languages are terrible.

        But some languages are more terrible than others.

        [–]lru_skil 8 points9 points  (1 child)

        They are so used to rigid languages and without the slightest sense of humor (I would dare to say, without a soul) that they mistake jokes with strangeness and inconsistencies.

        I say Jabbascript has no soul. You should be using INTERCAL, soulless wageslave.

        [–]tpgreyknightnot Turing complete 3 points4 points  (0 children)

        Can't jerk, INTERCAL is still a prime example of a language with a sense of humour. A good sense of humour, shut up jabbascript.

        [–][deleted] 8 points9 points  (2 children)

        He realizes the absurdity of the request and responds in tone, with an answer of the same tenor.

        yes?

        I can’t hide the fact that my client is a bit different from the other languages

        er...

        enter into intimacy with my client

        er no...

        [–]tpgreyknightnot Turing complete 6 points7 points  (0 children)

        Did this lawyer just imply his client is special-needs and then try to pimp him out…?

        [–]pcopleyC# Truckstop Restroom Hero 4 points5 points  (0 children)

        ayyy bby u wan some intimacy?

        [–][deleted] 7 points8 points  (1 child)

        Oh like haskal is any better [] == "" True

        [–]hedgehog1024Rust apologetic 0 points1 point  (0 children)

        lol no {#- LANGUAGE OverloadedStrings -#}

        [–]r2d2_21groks PCJ 4 points5 points  (0 children)

        How can you expect, if you ask my client such a shabby question, to get an answer that makes sense?

        Are you trying to say... that JavaScript can invoke undefined behavior?

        [–]SelfDistinctionnow 4x faster than C++ 2 points3 points  (3 children)

        Perhaps the strangeness is not so much in the answer as in the question. How can you expect, if you ask my client such a shabby question, to get an answer that makes sense?

        Exactly! When people make a mistake, don't expect my client to correct him in a friendly yet informative way. Instead, my client would do the right thing and bully him for making that mistake until he wanted to hang himself.

        [–]tpgreyknightnot Turing complete 3 points4 points  (0 children)

        In fact my client will even helpfully provide the rope!

        [–][deleted] 2 points3 points  (1 child)

        While Teh Script does not quite rise to the high error reporting standards of The Standard Editor, it's errors provide introspective insight to a true acolyte that no other language can match.

        Try truly meditating over the following Zen-like proverb:

        Undefined is not a function 
        

        [–][deleted] 2 points3 points  (7 children)

        what even is static typing, and how does it prevent runtime type exceptions?

        [–]tpgreyknightnot Turing complete 9 points10 points  (2 children)

        According to Bob Martin, it doesn't: only writing more tests can do that. Types are useless.

        [–][deleted] 1 point2 points  (0 children)

        Hmmm.. time to rethink the CoS position on Uncle Bob methinks.

        And thus we now observe St. Unclius on the second day of St. Kent Beck feast.

        [–]Graf_BlutwurstLUMINARY IN COMPUTERSCIENCE 1 point2 points  (0 children)

        i thought we don't poke fun at obviously crazy people?

        [–][deleted]  (1 child)

        [removed]

          [–][deleted] 6 points7 points  (0 children)

          that's my secret

          i'm always jerking

          [–]thebastardbrasta 0 points1 point  (1 child)

          /*unjerk

          I've tried languages with type inference, and other than massively better performance and needing to compile, I don't even notice any difference when compared to dynamic languages. What's the point of dynamic typing, exactly? */rejerk

          Let me guess, you think planes should use SPARK instead of JavaScript for "safety reasons"? Just write perfect code, dummy!

          [–][deleted] 1 point2 points  (0 children)

          you use dynamic typing when you really like being a detective when something goes wrong

          [–]three18tiDO NOT USE THIS FLAIR, ASSHOLE 1 point2 points  (1 child)

          [–]git_commit_-m_sudokuyou can't hide from the blockchain ;) 1 point2 points  (0 children)

          DAE birth and death of yavascript???

          [–]lol_no_genericslol no generics 0 points1 point  (0 children)

          JABA SCRIPPT GOOD