news.girolab.foo
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
not_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · 8 days ago

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

lemmy.blahaj.zone

message-square
20
link
fedilink
7

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 · 8 days ago
message-square
20
link
fedilink
  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 days 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.

    • TrickDacy@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      8 days ago

      Pretty sure that math.random is decades old.

      • meekah@discuss.tchncs.de
        link
        fedilink
        arrow-up
        0
        ·
        8 days ago

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

        • Ajen@sh.itjust.works
          link
          fedilink
          arrow-up
          1
          ·
          8 days ago

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

        • Sv443@sh.itjust.works
          link
          fedilink
          arrow-up
          1
          ·
          8 days ago

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

    • Billygoat@piefed.social
      link
      fedilink
      English
      arrow-up
      1
      ·
      8 days 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
        1
        ·
        8 days 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.

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.

  • 965 users / day
  • 1.07K users / week
  • 1.11K users / month
  • 1.15K users / 6 months
  • 1 local subscriber
  • 29.9K subscribers
  • 128 Posts
  • 422 Comments
  • Modlog
  • mods:
  • adr1an@programming.dev
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.15
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org