lemmy.onlylans.io
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
not_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · 14 hours ago

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

lemmy.blahaj.zone

message-square
43
fedilink
353

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 · 14 hours ago
message-square
43
fedilink
  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    101
    ·
    11 hours 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
      25
      ·
      6 hours 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
        16
        ·
        6 hours 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
      5
      ·
      edit-2
      11 hours ago

      Pretty sure that math.random is decades old.

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

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

        • Sv443@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          47 minutes ago

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

        • Ajen@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          3 hours ago

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

        • TrickDacy@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          5 hours ago

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

      • bleistift2@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        24
        ·
        11 hours ago

        Pretty sure OP’s image is hyperbole.

        • TrickDacy@lemmy.world
          link
          fedilink
          arrow-up
          4
          ·
          10 hours ago

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

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: [email protected]

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.

  • 1.16K users / day
  • 4.66K users / week
  • 8.57K users / month
  • 17.8K users / 6 months
  • 1 local subscriber
  • 29.7K subscribers
  • 2.11K Posts
  • 81.5K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org