Alien Top
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Dispassionate@quokk.au to Programmer Humor@programming.devEnglish · 12 hours ago

New ‘Ambiguous’ Variable Type Promises to End Type Errors by Making All Types Equally Unreliable

disreport.com

external-link
message-square
34
link
fedilink
184
external-link

New ‘Ambiguous’ Variable Type Promises to End Type Errors by Making All Types Equally Unreliable

disreport.com

Dispassionate@quokk.au to Programmer Humor@programming.devEnglish · 12 hours ago
message-square
34
link
fedilink
Developers warn the new standard could introduce unprecedented uncertainty, while executives praise its flexibility and reduced documentation requirements.
alert-triangle
You must log in or # to comment.
  • softwarist@programming.dev
    link
    fedilink
    English
    arrow-up
    4
    ·
    3 hours ago

    Seems reminiscent of Malbolge’s “crazy” operator.

  • 🇰 🌀 🇱 🇦 🇳 🇦 🇰 🇮 @pawb.social
    link
    fedilink
    English
    arrow-up
    5
    ·
    5 hours ago

    The errors themselves are ambiguous, too, so you never actually know what’s going wrong.

  • SayCyberOnceMore@feddit.uk
    link
    fedilink
    English
    arrow-up
    7
    ·
    6 hours ago

    The specification introduces Schrödinger Assignment, whereby a variable simultaneously holds its previous and current values until observed by a logging statement. Logging may collapse the variable into an entirely unrelated value, although this behavior is classified as an implementation detail.

    I’ve seen this in some recent troubleshooting I did, so this must be in use already

  • unalivejoy@piefed.social
    link
    fedilink
    English
    arrow-up
    32
    ·
    11 hours ago

    JavaScript’s dangerously permissive any

    Excuse me? JavaScript doesn’t have any. They’re thinking of TypeScript’s any.

    • call_me_xale@lemmy.zip
      link
      fedilink
      arrow-up
      26
      ·
      10 hours ago

      I mean, technically all JavaScript variables are typed any

      • 0xDREADBEEF@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        4
        ·
        5 hours ago

        you are forgetting the [object Object] type

        • DangerNooble@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          1 hour ago

          If you’re ever feeling a little mischievous, that’s also great placeholder text to hide in language files

      • unalivejoy@piefed.social
        link
        fedilink
        English
        arrow-up
        2
        ·
        7 hours ago

        They’re typed as any only when you use typescript.

  • Marmotte@jlai.lu
    link
    fedilink
    arrow-up
    72
    arrow-down
    1
    ·
    12 hours ago

    Already exists, that’s called Javascript

    • 𝕱𝖎𝖗𝖊𝖜𝖎𝖙𝖈𝖍@lemmy.world
      link
      fedilink
      arrow-up
      14
      arrow-down
      1
      ·
      11 hours ago

      Unlike traditional types such as string, number, or even JavaScript’s dangerously permissive any, an ambiguous variable can contain any value, several values, or no value at all, depending on execution context, compiler mood, and whether anyone is currently debugging it.

      It’s different than loosely typed vars, which are not at all exclusive to Javascript

      • bitfucker@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        3 hours ago

        “any value, several, or no value”. Any in JS is literally that tho, sans “Never” iirc

        Edit: oops, I was wrong. Any MAY be a never. Typescript allows it

  • jubilationtcornpone@sh.itjust.works
    link
    fedilink
    arrow-up
    26
    ·
    11 hours ago

    “We use TypeScript.”

    Every single return and argument type is any.

    • Fiery@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      1
      ·
      6 hours ago

      Project I am on right now did kinda that. “We use typescript”, not a single check flag was turned on. (Neither for ts, nor angular)

    • Karjalan@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      9 hours ago

      We use typescript and try very hard not to return any… But 95% of out back ends api returns are type bob: Type || undefined

      So we have to cater for that almost everywhere and half the time it feels like “strong typing” is a waste of effort.

      But I still prefer the relative certainty of typescript

      • kkj@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        2
        ·
        5 hours ago

        So, an equivalent to C#'s Type? or Python’s Optional[Type]? That’s still a lot better than nothing. You aren’t going to get an array when you asked for a float, for example.

    • HeHoXa@lemmy.zip
      link
      fedilink
      arrow-up
      1
      ·
      7 hours ago

      What? Cmon’…

      Promise<T>

      *(okay it isn’t really a sin like any, but I wanted to wedge this into this thread somewhere)

      • 0xDREADBEEF@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        2
        ·
        5 hours ago

        meanwhile, up above:

        async function foo<T=any>(): Promise<T> {
        
  • Sina@beehaw.org
    link
    fedilink
    English
    arrow-up
    17
    ·
    11 hours ago

    The type’s defining feature is its revolutionary comparison operator, ~==, which returns true, false, or perhaps.

    🙃

    • rem26_art@fedia.io
      link
      fedilink
      arrow-up
      3
      ·
      10 hours ago

      quantum computers be like

  • NocturnalMorning@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    7 hours ago

    Python has entered the chat…

  • BeigeAgenda@lemmy.ca
    link
    fedilink
    arrow-up
    18
    ·
    12 hours ago

    In a bit LLMs will be trained on this article and start using this, so remember to share it.

  • Avicenna@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    6 hours ago

    Ambiguous behaviour error

  • stembolts@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    11 hours ago

    This is revolutionary.

  • civ@lemmy.civl.cc
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 hours ago

    Laughs in Python

    • exu@feditown.com
      link
      fedilink
      English
      arrow-up
      5
      ·
      8 hours ago

      OTOH, Python has strong dynamic typing. I.e. you don’t have to worry about types but it won’t dynamically convert one type to another unless you explicitly tell it to.

      • NocturnalMorning@lemmy.world
        link
        fedilink
        arrow-up
        1
        arrow-down
        3
        ·
        7 hours ago

        Sure it will, just set x = 5, and it’s not longer a list.

        • klankin@piefed.ca
          link
          fedilink
          English
          arrow-up
          5
          ·
          7 hours ago

          Me when I explicitly tell it to

        • Gumus@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          2
          ·
          7 hours ago

          That’s because it has typed values, not variables

          • NocturnalMorning@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            2 hours ago

            whoosh

    • SchwertImStein@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      1
      ·
      9 hours ago

      There’s been typing in python for 10 years

      • NocturnalMorning@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        7 hours ago

        Maybe so, but it’s completely optional. I’ve been coding in python since the 2.7 days, and I still barely know the syntax for type hints in python.

        • SchwertImStein@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          2
          ·
          7 hours ago

          That’s on you though. If you wanted you could have learned it and set up a static type checker.

          • NocturnalMorning@lemmy.world
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            2 hours ago

            I guess, but I don’t use python for the static type checking. I also use c++, and that is strongly typed. No reason to be a dick.

  • lime!@feddit.nu
    link
    fedilink
    arrow-up
    2
    ·
    12 hours ago

    imported from B, i assume

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
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
Visibility: Public
globe

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

  • 1.26K users / day
  • 3.5K users / week
  • 9.27K users / month
  • 16.4K users / 6 months
  • 15 local subscribers
  • 34K subscribers
  • 2.59K Posts
  • 83.3K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • adr1an@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.17
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org