Orbiting Observer
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
JPDev@programming.dev to Programmer Humor@programming.dev · 2 years ago

ifn't

programming.dev

message-square
68
link
fedilink
141

ifn't

programming.dev

JPDev@programming.dev to Programmer Humor@programming.dev · 2 years ago
message-square
68
link
fedilink
alert-triangle
You must log in or # to comment.
  • Trailblazing Braille Taser@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    37
    ·
    2 years ago

    I propose a new, more threatening kind of control flow.

    do {
      /* something */
    } or else {
      /* you don't want to find out */
    }
    
    • moody@lemmings.world
      link
      fedilink
      arrow-up
      14
      ·
      2 years ago

      It_would_be_a_shame_if(condition)

    • jadelord@discuss.tchncs.de
      link
      fedilink
      arrow-up
      8
      ·
      2 years ago

      It exists, kind of. Python has this construct

      for item in iterable:
          ...
      else:
           ...
      

      which always puzzles me, since it depends on a break statement execution. I always have to look it up when the else block is executed.

    • rothaine@beehaw.org
      link
      fedilink
      English
      arrow-up
      5
      ·
      2 years ago
      do {
        /* something */
      } do hast {
        /* something */
      }
      
      • Trailblazing Braille Taser@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        7
        ·
        2 years ago
        do {
          /* something */
        } do hast {
          /* something */
        } do hast mich {
          /* something */
        }
        
    • Mesa@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      2 years ago

      The better try-catch. More intuitive if you ask me.

    • Strawberry@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      this is just a menacing try/catch!

    • gex@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      Some C++ style guides suggest the following naming convention for functions that crash on any error

      OpenFileOrDie()
      
      • xmunk@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        PHP has the always wonderful (and perfectly functional) syntax of

        logUserIn() or die();

        • msage@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          2 years ago

          Or Perl

          • frezik@midwest.social
            link
            fedilink
            arrow-up
            1
            ·
            2 years ago

            Perl also has unless() for the very purpose in OP, which is a more sensible choice.

            Oh, and if you need to reinforce your belief that Perl is a mess, the single-quote character can be used as a package separator instead of “::”. This was set in the 90s when nobody was quite sure of the right syntax for package separators, so it borrowed “::” from C++ and the single quote from Ada (I think).

            That means the ifn't() in OP can be interpreted as calling the t() function on the ifn package.

            The “::” separator is vastly preferred, though. Single quotes run havoc on syntax highlighting text editors (since they can also be used for strings). About the only time I’ve seen it used is a joke module, Acme::don't.

      • Kissaki@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 years ago

        Personally, I like to call catched exception variables up, so for a rethrow I can throw up;.

        • TwilightKiddy@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          2 years ago

          Except rethrowing an exception in C# is just throw;, anything else is a crime against the person who reads your stacktraces.

    • OpenStars@startrek.website
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      2 years ago

      You just made me a offer I can’t refuse. I go now to sleep with the fishes…

  • csm10495@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    21
    ·
    2 years ago

    Imagine the regex needed to highlight code with that extra single quote.

  • janabuggs@beehaw.org
    link
    fedilink
    arrow-up
    19
    arrow-down
    1
    ·
    2 years ago

    I’m struggling to understand if this is true or ifn’t true

  • rimjob_rainer@discuss.tchncs.de
    link
    fedilink
    arrow-up
    14
    ·
    2 years ago

    Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.

    • Ookami38@sh.itjust.works
      link
      fedilink
      arrow-up
      13
      ·
      2 years ago

      I think it’s just capitalizing on a trend to add n’t to otherwise noy contractions, to make them into contractions. Contractionn’ts, if you will

    • Ferk@kbin.social
      link
      fedilink
      arrow-up
      7
      ·
      2 years ago

      Yes… how is “reducing exclamation marks” a good thing when you do it by adding a ' (not to be confused with , ´,‘or’` …which are all different characters).

      Does this rely on the assumption that everyone uses a US QWERTY keyboard where ! happens to be slightly more inconvenient than typing '?

  • MagicShel@programming.dev
    link
    fedilink
    arrow-up
    13
    ·
    2 years ago

    Reduce exclamation marks!? Great Scott!!! Is there a shortage of punctuation in the future!?

    • KairuByte@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

      You could have saved two, all you had to do was use the interrobang. You’re a monster.

    • SubArcticTundra@lemmy.ml
      link
      fedilink
      arrow-up
      5
      ·
      2 years ago

      All known deposits were depleted

  • OpenStars@startrek.website
    link
    fedilink
    English
    arrow-up
    14
    arrow-down
    2
    ·
    2 years ago

    Please God let this be a humorous post that somehow does not also find a way to manage to come true…

    • jtk@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      13
      ·
      2 years ago

      I would have bought it if they said ifnot instead, it’s the same number of characters and wouldn’t require a major parser overhaul to support keywords with a ’ in the name.

      • Pup Biru@aussie.zone
        link
        fedilink
        arrow-up
        7
        ·
        2 years ago

        i mean, “unless” tends to be the usual term for an “if not” keyword in languages that implement such a thing

        • Fal@yiffit.net
          link
          fedilink
          English
          arrow-up
          6
          arrow-down
          2
          ·
          2 years ago

          Which is awful and incredibly confusing. I hate ruby

          • msage@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            2 years ago

            And Perl

            • NigelFrobisher@aussie.zone
              link
              fedilink
              arrow-up
              3
              ·
              2 years ago

              And my axe!

          • Pup Biru@aussie.zone
            link
            fedilink
            arrow-up
            1
            ·
            2 years ago

            totally agree; just saying that if it’s GOT to be something, that something should probably be unless… unless . . .

          • frezik@midwest.social
            link
            fedilink
            arrow-up
            1
            ·
            2 years ago

            I find that you need to choose carefully when to use it. Simple cases tend to be alright. Larger, more complex conditions shouldn’t touch it.

      • OpenStars@startrek.website
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        1
        ·
        2 years ago

        Yeah, to be clear, I don’t like it, I don’t like it one bit:-P.

    • mryessir@lemmy.sdf.org
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      deleted by creator

      • OpenStars@startrek.website
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        2 years ago

        Gulp…

         [link]

        Also, just for fun, the prequel:

  • من البحر إلى النهر@lemmy.worldBanned
    link
    fedilink
    arrow-up
    11
    arrow-down
    2
    ·
    2 years ago

    This can’t be for real. I’ll stick with C11 thank you.

    • StarDreamer@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      27
      ·
      2 years ago

      Here you dropped this:

      #define ifnt(x) if (!(x))
      
  • xia@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    7
    arrow-down
    1
    ·
    2 years ago

    “Help’s with readability”? You know what else helps? Not using contractions and introducing an unbalanced single quote.

    • bdonvr@thelemmy.club
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

      If they’d’nt’ve done that, it’d’ve been better. Agreed.

      • Cwilliams@beehaw.org
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        they’d’nt’ve

        Aside: rip Tom Scott

    • frezik@midwest.social
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      Runs havoc on parsing, too. It’s bad for both humans and robots. I say we ship it.

    • survivalmachine@beehaw.org
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      This feels racist against Appalachia. We naturally speak with contractions and are commonly referred to as “unbalanced”.

  • jtk@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 years ago
    ifn't (myNum don't= 3 && myStr ain'tnull'rblankish)
    
    • SubArcticTundra@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      I hate seeing colloquial terms like ‘ain’t’ in non-comment (ie. standardized) parts of code

  • xmunk@sh.itjust.works
    link
    fedilink
    arrow-up
    3
    ·
    2 years ago

    Still not as good as whence

    • fartsparkles@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      Is this a reference to something because I’d love to read it if you have a time to share.

      • xx3rawr@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 years ago

        Woah. I did a quick google and it’s not just a meme, but actually used in some major lang’s libraries.

        • jjjalljs@ttrpg.network
          link
          fedilink
          arrow-up
          0
          ·
          2 years ago

          This is one of those “modern Google/search sucks” moments because I couldn’t immediately find examples of it in a programming language.

          • xx3rawr@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 years ago

            I actually used DDG and most I’ve seen, they’re just used as arguments for functions notably in C and Python

  • fl42v@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    This has to be illegal. I mean, it’s basically suicide incitement (or whatever is the phrase for it)

  • Serpent7776@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 years ago

    I can actually define this in TCL:

    % proc ifn't {cond cmds} {if {!$cond} {uplevel $cmds}}
    % ifn't false {puts 12}
    12
    % ifn't true {puts 12}
    % 
    
  • Hexbear2 [any]@hexbear.net
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    This is the !biggest comp sci innovation in !decades

  • Bappity@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    cap () {

    }
    nocap () {

    }

    • runner_g@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      nocap(frfr){

      }

  • tiredofsametab@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    die unless $keyword == “unless”;

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.

  • 1.82K users / day
  • 3.48K users / week
  • 7.62K users / month
  • 17.8K users / 6 months
  • 1 local subscriber
  • 28.3K subscribers
  • 1.88K Posts
  • 65.6K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.13
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org