• Lemminary@lemmy.world
      link
      fedilink
      arrow-up
      15
      ·
      6 days ago

      In the language Gulf of Mexico

      HUH?

      Some languages start arrays at 0, which can be unintuitive for beginners. Some languages start arrays at 1, which isn’t representative of how the code actually works. Gulf of Mexico does the best of both worlds: Arrays start at -1.

      Oh, I see they’re serious! Time to ditch JavaScript.

    • luciferofastora@feddit.org
      link
      fedilink
      arrow-up
      8
      ·
      edit-2
      6 days ago

      Naming

      Both variables and constants can be named with any Unicode character or string.

      const const letter = 'A'!
      var const 👍 = True!
      var var 1️⃣ = 1!
      

      This includes numbers, and other language constructs.

      const const 5 = 4!
      print(2 + 2 === 5)! //true
      

      This is a recipe for disaster I kinda wanna try

    • Revan343@lemmy.ca
      link
      fedilink
      arrow-up
      4
      ·
      6 days ago

      If you’re unsure, that’s ok. You can put a question mark at the end of a line instead. It prints debug info about that line to the console for you.

      print("Hello world")?

      Fucking sold, I was gonna learn rust but you’ve changed my mind

  • count_dongulus@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    6 days ago

    Not exactly aimed at language keywords (although it is aimed at the language designers who decided abbreviations in keywords are acceptable):

    I hate abbreviations in source code so fucking much. Reading is more of software engineering than writing. If you cannot be bothered to type a whole word because typing is hard for you, find a different job. Do not force others to engage in mental gymnastics to understand what the fuck a variable or function is supposed to mean.

    • Static_Rocket@lemmy.world
      link
      fedilink
      English
      arrow-up
      12
      ·
      6 days ago

      There was a rather famous piece of software at my last job. Guy writing it wanted job security. A lot of the core variables of the application were named based on the sounds a helicopter made. God damn onomatopoeia variables. Pretty sure that shit is still in use somewhere.

      • MonkeMischief@lemmy.today
        link
        fedilink
        arrow-up
        4
        ·
        6 days ago

        I can’t imagine writing something like that. Job security? Hah, I’d end up in an inescapable labyrinth of my own making if I named things something that wouldn’t be obvious to my 3-months-later self!

        Maybe that’s the play: He intentionally confuses himself so it takes extra paid time to remember what the heck “SOISOISOI” does, compared to “Whopwhopwhop”.

    • crimsonpoodle@pawb.social
      link
      fedilink
      arrow-up
      3
      ·
      6 days ago

      I get that but also can be kinda nice to have density so that you can read more of the program on a single display.

  • krooklochurm@lemmy.ca
    link
    fedilink
    arrow-up
    11
    ·
    6 days ago

    Bash was derived by a team of criminally insane programmers in the bowels of a South American asylum so deep in the jungle no country can rightfully claim it as its own. It is the product of the demented keystrokes of the damned, possessing a singular logic so alien that its developers can hardly be said to be human at all.

    And I wouldn’t have it any other way.

    • meekah@discuss.tchncs.de
      link
      fedilink
      arrow-up
      6
      arrow-down
      1
      ·
      7 days ago

      You press c and t using the same finger, and i with another. So since you need to use the same finger twice in a row, also moving it a fair distance in between, your other finger just presses the button a little bit too soon, and that’s how you end up with funciton

      • [object Object]@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        6 days ago

        ‘c’ and ‘t’ should definitely be hit with different fingers if you do touch-typing. But with one hand, that’s true.

      • drath@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        6 days ago

        I just recorded myself typing it a dozen of times, and it always goes as:

        F - Left index U - Right middle N - Right index C - Left index T - Left middle I - Right middle O - Right ring N - Right index

        I usually generally follow zones while typing, but for frequent words like this I tend to break it, which mostly make sense, like using middle finger for U to free index finger for N, and then moving it one over for a quick IO without lifting the index from N), but then that CT thing is a decades-long ingrained thing that I didn’t even realize how weird it was until I looked closely at it. It reminds me of that thing that bothers me on my other kb which is ortholinear and I always struggle in games with it because I can’t press 2 while holding Shift and W at the same time. On normal keyboards I use ring fingers and slightly twist my wrist clockwise, but on ortholinear it’s not there, and it’s actually easier to use index finger and twist the other way, or roll middle over without lifting, but it’s very hard to break that habit.

      • dogs0n@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        6 days ago

        Autohotkey? Naw, you wanna setup a daily cron job to read and replace every one of your common typos with the correct spelling. That’s the way, trust me.

        Edit: Daily cron job typo correction.

      • MajorasTerribleFate@lemmy.zip
        link
        fedilink
        arrow-up
        2
        ·
        6 days ago

        Dude, I set up wild crap with Autohotkey, for a job. I had it logging in to vendor websites where it would pull up clients, compare contact info to our local system, check if recent payment had been made, pull appropriate client docs (if not already in our local system), and leave notes for me before moving onto the next client on the list. I had AHK doing most of the job I was hired for.

        Thankfully, the multiple vendor websites made occasional changes to their layouts, color schemes, etc. so all my methods of navigation would inevitably break, requiring me to maintain it.

        I was also building stuff where it would automatically fire off an email at certain points if there was a special change to tell the client about, if payment wasn’t seen on the vendor site by certain deadlines, etc.

        That job eventually fell through for unrelated reasons (they moved me off that to somewhere they needed me more, and several years later got pushed out of that position and the company entirely).

        Where do I get a job that let’s me build that stuff again?!

        • UnrepentantAlgebra@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          6 days ago

          In a perfect world you could get paid to automate stuff with AHK. I wonder if you could market yourself as an AHK consultant where you basically shadow someone’s job for a week and then start figuring out how to automate the tedious stuff.

          Personally I like the functionality of AHK but I can’t stand the syntax compared to Python and C. I start with such great plans of what I want to automate but get sick of fighting with the language after about an hour and settle for something simple.

          • MajorasTerribleFate@lemmy.zip
            link
            fedilink
            arrow-up
            1
            ·
            6 days ago

            I actually started thinking about exactly this minutes later, and have been VERY excited about trying it. I’ve been unemployed for awhile now, not by choice, and already have diagnosed depression going back years before. Job market stinks and I’m bad at getting hired. BUT this idea actually excites me, in a way I haven’t felt in WAY too long.

            I plan to start working on some basic function libraries for myself, rebuilding some things from that old job, and I’ll also be contacting local businesses for a start. The old job was for a small business, so I have a decent feel for how to fit it into places.

  • ulterno@programming.dev
    link
    fedilink
    English
    arrow-up
    6
    ·
    6 days ago

    While C feels fine without having a keyword for function, I feel like bash would have benefitted from it.

    • excess0680@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      6 days ago

      Bash (specifically Bash, not POSIX sh) does have a keyword for functions (function), but it’s optional.

      • ulterno@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 days ago

        Ooh nice.

        The optional bit messed it up, because even though I can make my scripts easier for me, other’s scripts won’t be.
        But then bash had to be usable with sh scripts, so I get it.

        • excess0680@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          5 days ago

          Right. It’s optional so that Bash remains backwards compatible as a superset of POSIX sh. If you’re working with exclusively Bash, though, it’s nice to use as syntactic sugar if nothing else.

  • NotSteve_@piefed.ca
    link
    fedilink
    English
    arrow-up
    38
    ·
    edit-2
    7 days ago

    def (): is pretty nice

    Edit: also as someone doing a bunch of CI work right now, Bash can GTFO (unless the alternative is whatever Windows is doing)