Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. JavaScript

JavaScript

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
152 Posts 83 Posters 2 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 3 [email protected]

    Sure. And you're entitled to yours. But words have meaning and this isn't MY OPINION, it's objective reality. It follows strict rules for predictable output, it is not nonsensical.

    You're entitled to think it's nonsense, and you'd be wrong. You don't have to like implicit type coercion, but it's popular and in many languages for good reason...

    Language Implicit Coercion Example
    JavaScript '5' - 1 → 4
    PHP '5' + 1 → 6
    Perl '5' + 1 → 6
    Bash $(( '5' + 1 )) → 6
    Lua "5" + 1 → 6
    R "5" + 1 → 6
    MATLAB '5' + 1 → 54 (ASCII math)
    SQL (MySQL) '5' + 1 → 6
    Visual Basic '5' + 1 → 6
    TypeScript '5' - 1 → 4
    Tcl "5" + 1 → 6
    Awk '5' + 1 → 6
    PowerShell '5' + 1 → 6
    ColdFusion '5' + 1 → 6
    VBScript '5' + 1 → 6
    ActionScript '5' - 1 → 4
    Objective-J '5' - 1 → 4
    Excel Formula "5" + 1 → 6
    PostScript (5) 1 add → 6

    I think JavaScript is filthy, I'm at home with C#, but I understand and don't fear ITC.

    R This user is from outside of this forum
    R This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #103

    C# is filthy. But it explains where you got your warped idea of righteousness.

    1 Reply Last reply
    0
    • 3 [email protected]

      Sure. And you're entitled to yours. But words have meaning and this isn't MY OPINION, it's objective reality. It follows strict rules for predictable output, it is not nonsensical.

      You're entitled to think it's nonsense, and you'd be wrong. You don't have to like implicit type coercion, but it's popular and in many languages for good reason...

      Language Implicit Coercion Example
      JavaScript '5' - 1 → 4
      PHP '5' + 1 → 6
      Perl '5' + 1 → 6
      Bash $(( '5' + 1 )) → 6
      Lua "5" + 1 → 6
      R "5" + 1 → 6
      MATLAB '5' + 1 → 54 (ASCII math)
      SQL (MySQL) '5' + 1 → 6
      Visual Basic '5' + 1 → 6
      TypeScript '5' - 1 → 4
      Tcl "5" + 1 → 6
      Awk '5' + 1 → 6
      PowerShell '5' + 1 → 6
      ColdFusion '5' + 1 → 6
      VBScript '5' + 1 → 6
      ActionScript '5' - 1 → 4
      Objective-J '5' - 1 → 4
      Excel Formula "5" + 1 → 6
      PostScript (5) 1 add → 6

      I think JavaScript is filthy, I'm at home with C#, but I understand and don't fear ITC.

      R This user is from outside of this forum
      R This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #104

      Also, you contradicted yourself just then and there. Not a single of your examples does string concatenation for these types. It's only JS

      B 1 Reply Last reply
      1
      • C [email protected]

        Use typescript

        T This user is from outside of this forum
        T This user is from outside of this forum
        [email protected]
        wrote on last edited by [email protected]
        #105

        No. I don't want to transpile. I don't want a bundle. I want a simple site that works in the browser. I want to serve it as a static site. I don't want a build step. I don't want node_modules. I want to code using the language targeted for the platform without any other nonsense.

        Javascript is cancer. Fucking left pad?! How the fuck did we let that happen? What is this insane fucking compulsion to have libraries for two lines of code? To need configuration after configuration just to run fucking hello world with types and linting?

        No, fuck Typescript. Microsoft owns enough. They own where you store your code. They own your IDE. They might own your operating system. Too much in one place. They don't need to own the language I use, too.

        "Let's use a proprietary improvement to fix the standard that should have not sucked in the first place" is why we can't have nice things.

        No.

        1 Reply Last reply
        7
        • cm0002@lemmy.worldC [email protected]
          This post did not contain any content.
          R This user is from outside of this forum
          R This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #106

          Imagine doing math with strings and then blaming the language not yourself

          Z gmtom@lemmy.worldG 2 Replies Last reply
          35
          • R [email protected]

            Imagine doing math with strings and then blaming the language not yourself

            Z This user is from outside of this forum
            Z This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #107

            The risk is when it happens unintentionally. The language is bad for hiding such errors by being overly 'helpful' in assuming intent.

            F 1 Reply Last reply
            42
            • Z [email protected]

              The risk is when it happens unintentionally. The language is bad for hiding such errors by being overly 'helpful' in assuming intent.

              F This user is from outside of this forum
              F This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #108

              Sure, but at this point it's your own fault if you don't use Typescript to keep these issues from happening.

              S J 2 Replies Last reply
              11
              • F [email protected]

                Sure, but at this point it's your own fault if you don't use Typescript to keep these issues from happening.

                S This user is from outside of this forum
                S This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #109

                So, just don’t use JavaScript?

                F M S 3 Replies Last reply
                8
                • F [email protected]

                  It makes perfect sense if the Lang objective is to fail as little as possible. It picks the left side object, checks if the operand is a valid operand of the type. If it is, it casts the right variable into that type and perform the operand. If it isn't, it reverses operand positions and tries again.

                  The issue here is more the fact that + is used both as addition and as concatenation with different data types. Well, not an issue, just some people will complain.

                  G This user is from outside of this forum
                  G This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #110

                  Computing a nonsensical result is itself a failure. Continuing to run while avoiding giving an error in that case accomplishes nothing but to make the program harder to debug.

                  1 Reply Last reply
                  0
                  • S [email protected]

                    So, just don’t use JavaScript?

                    F This user is from outside of this forum
                    F This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #111

                    I wouldn't use raw JS for anything new, yes. Typescript however is an excellent language.

                    1 Reply Last reply
                    3
                    • L [email protected]

                      I don't even know Haskell but it seems like (" ( , ) ") would be an instance of boob.

                      B This user is from outside of this forum
                      B This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #112

                      (.) is a valid expression in Haskell. Normally it is the prefix form of the infix operator . that does function
                      composition. (.) (2*) (1+) 3 = ((2*) . (1+)) 3 = 2 * (1 + 3) = 8.

                      But, the most common use of the word "boob" in my experience in Haskell is the "boobs operator": (.)(.). It's usage in Haskell is limited (tho valid), but it's appearance in racy ASCII art predates even the first versions on Haskell.

                      L 1 Reply Last reply
                      0
                      • K [email protected]

                        That is just the tip of the iceberg:

                        https://whatthefsharp.com/JavaScript/3

                        W This user is from outside of this forum
                        W This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #113

                        Haha that’s a great site. But I think the C example is actually reasonable behaviour.

                        1 Reply Last reply
                        2
                        • J [email protected]

                          Instead of trying to make it work, javascript could just say "error." Being untyped doesn't mean you can't have error messages.

                          B This user is from outside of this forum
                          B This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #114

                          I think it's less about type system, and more about lack of a separate compilation step.

                          With a compilation step, you can have error messages that developers see, but users don't. (Hopefully, these errors enable the developers to reduce the errors that users see, and just generally improve the UX, but that's NOT guaranteed.)

                          Without a compilation step, you have to assign some semantics to whatever random source string your interpreter gets. And, while you can certainly make that an error, that would rarely be helpful for the user. JS instead made the choice to, as much as possible, avoid error semantics in favor of silent coercions, conversions, and conflations in order to make every attempt to not "error-out" on the user.

                          It would be a very painful decade indeed to now change the semantics for some JS source text.

                          Purescript is a great option. Typescript is okay. You could also introduce a JS-to-JS "compilation" step that DID reject (or at least warn the developer) for source text that "should" be given an error semantic, but I don't know an "off-the-shelf" approach for that -- other than JSLint.

                          1 Reply Last reply
                          1
                          • R [email protected]

                            Also, you contradicted yourself just then and there. Not a single of your examples does string concatenation for these types. It's only JS

                            B This user is from outside of this forum
                            B This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #115
                            • In https://lemm.ee/comment/20947041 they claimed "implicit type coercion" and showed many examples; they did NOT claim "string concatenation".
                            • However, that was in reply to https://lemmy.world/comment/17473361 which was talking about "implicit conversion to string" which is a specific type of "implicit type coercion"; NONE of the examples given involved a conversion to string.
                            • But also, that was in reply to https://lemm.ee/comment/20939144 which only mentions "implicit type coercion" in general.

                            So, I think probably everyone in the thread is "correct", but you are actually talking past one another.

                            I think the JS behavior is a bad design choice, but it is well documented and consistent across implementations.

                            R 1 Reply Last reply
                            2
                            • F [email protected]

                              Sure, but at this point it's your own fault if you don't use Typescript to keep these issues from happening.

                              J This user is from outside of this forum
                              J This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #116

                              "Use a different language" is a common defense of javascript, but kind of a weird one.

                              F 1 Reply Last reply
                              22
                              • cm0002@lemmy.worldC [email protected]
                                This post did not contain any content.
                                K This user is from outside of this forum
                                K This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #117

                                If you're consciously and intentionally using JavaScript like that, I don't want to be friends with you.

                                1 Reply Last reply
                                4
                                • J [email protected]

                                  "Use a different language" is a common defense of javascript, but kind of a weird one.

                                  F This user is from outside of this forum
                                  F This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #118

                                  Not really, considering Typescript only adds static types to JS. It's not a different language, it's an extension.

                                  Q 1 Reply Last reply
                                  4
                                  • R [email protected]

                                    Imagine doing math with strings and then blaming the language not yourself

                                    gmtom@lemmy.worldG This user is from outside of this forum
                                    gmtom@lemmy.worldG This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #119

                                    The problem is consistency.

                                    1 Reply Last reply
                                    14
                                    • cm0002@lemmy.worldC [email protected]
                                      This post did not contain any content.
                                      A This user is from outside of this forum
                                      A This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by [email protected]
                                      #120

                                      Javascript is a dogshit language that everyone is stuck with. The best that we can hope for is the likes of typescript take the edge off of it. Even though it's like smearing marzipan over a turd. At least it's ok if you don't take a deep bite.

                                      1 Reply Last reply
                                      14
                                      • S [email protected]

                                        So, all you've mustered is some lame-ass whataboutism?
                                        Have a good day

                                        supervisor194@lemmy.worldS This user is from outside of this forum
                                        supervisor194@lemmy.worldS This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #121

                                        So you don't have a suggestion. Got it.

                                        S 1 Reply Last reply
                                        0
                                        • supervisor194@lemmy.worldS [email protected]

                                          So you don't have a suggestion. Got it.

                                          S This user is from outside of this forum
                                          S This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by
                                          #122

                                          Of course. Nothing beats JS, oh guru mighty guru

                                          supervisor194@lemmy.worldS 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups