not digg
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
not_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · 2 days ago

POV: You maintain a JS library that 80% of modern web infrastructure uses as a dependency.

lemmy.blahaj.zone

message-square
48
fedilink
398

POV: You maintain a JS library that 80% of modern web infrastructure uses as a dependency.

lemmy.blahaj.zone

not_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · 2 days ago
message-square
48
fedilink
  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    121
    ·
    1 day ago

    One way in which this could have come about is that Math.random wasn’t supported in all relevant browsers when the library author wrote the library. So they had to roll their own randomness with blackjack and hookers. Later the web standards evolved and the author was able to remove the custom code, but now had people relying on his library’s exposing a getRandom function.

    • Billygoat@piefed.social
      link
      fedilink
      English
      arrow-up
      42
      ·
      1 day ago

      You see this kind of stuff in C all the time when a code base supports multiple OSs by using macros.

      • chonglibloodsport@lemmy.world
        link
        fedilink
        arrow-up
        25
        ·
        1 day ago

        Yes, though at least with C you have the compiler to optimize the cruft out of your binary and end up with a nice, clean program.

        With JavaScript this is going to incur some runtime cost everywhere this library is used, even if it only happens once when getting optimized out by the JIT compiler.

    • TrickDacy@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      edit-2
      1 day ago

      Pretty sure that math.random is decades old.

      • bleistift2@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        29
        ·
        1 day ago

        Pretty sure OP’s image is hyperbole.

        • TrickDacy@lemmy.world
          link
          fedilink
          arrow-up
          6
          ·
          1 day ago

          Right. I’d agree this is a thing that happens, I just thought you were addressing this one in particular

      • meekah@discuss.tchncs.de
        link
        fedilink
        arrow-up
        6
        arrow-down
        1
        ·
        1 day ago

        Pretty sure many codebases running today (even JS ones) are older

        • Sv443@sh.itjust.works
          link
          fedilink
          arrow-up
          8
          ·
          23 hours ago

          Math.random() was always in the spec: https://ecma-international.org/wp-content/uploads/ECMA-262_1st_edition_june_1997.pdf

          • sparky@lemmy.federate.cc@lemmy.federate.cc
            link
            fedilink
            arrow-up
            1
            ·
            17 hours ago

            Remember IE? Yeah. Probably responsible for a lot of now-superfluous things like this theory suggests.

          • meekah@discuss.tchncs.de
            link
            fedilink
            arrow-up
            1
            ·
            22 hours ago

            Gotta admit, didn’t think it was that old

        • Ajen@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          1 day ago

          How many JS codebases are over 30 years old? Can you name even one?

        • TrickDacy@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          1 day ago

          And? I don’t know how to check but I’d guess math.random was included from the beginning.

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 274 users / day
  • 3.88K users / week
  • 5.6K users / month
  • 14.9K users / 6 months
  • 1 local subscriber
  • 29.7K subscribers
  • 2.07K Posts
  • 32.1K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org