• scratchresistor@thelemmy.club
        link
        fedilink
        arrow-up
        1
        ·
        11 months ago

        Don’t forget to keep your return values…

        rescued_princesses = [{"princess": princess, "rescued": princess.rescue()} for princess in [castle.get_princess() for castle in castles]]

  • EvilHaitianEatingYourCat@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    11 months ago

    So let me summarise this:

    Only C and Lisp actually completed the initial task of getting the princess free, and Author clearly favors C over the drooling and homeless lisp hacker. Also, turns out, C greatest weakness helped to save not only the princess but everything she ever possessed! How convenient!

  • FlumPHP@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    11 months ago

    I’m going to have to print out the Go version for all future “it’s idiomatic” and “but the community!” debates at work

      • FlumPHP@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        11 months ago

        The go community is strongly opinionated in unique ways. For example, using libraries is generally frowned upon. You either use something included in the language itself (standard library) or copy/paste the code you wrote in another project. There’s also advocacy for shorter variable names which generally seems counter to the normal “write descriptive variable name” mantra.

        All in all, I hope the ideas / opinions came from a good place and then some people took them as black & white rules. But they also come off as one or two people’s pet peeves who got to build a language around them.

    • Troy@lemmy.ca
      link
      fedilink
      arrow-up
      3
      ·
      11 months ago

      You have python. You import antigravity. The princess flies off into space. You monkey patch the princess so she has wings.

  • mindbleach@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    11 months ago

    You have Perl.

    %_=~aj/dy/hfiw8i/g;
    $_/a(h0w8)y@;
    FWA/E.*FW[tu29uy]/;
    %(1)hjc/f4ifh38/y;

    The princess is saved, but all you can think about is rescuing another, with an entirely different plan. Which is just as well because you have no fucking idea how to explain the one you just wrote and executed.