cross-posted from: https://lemmy.ml/post/39334581
JS:
() => {}In the language Gulf of Mexico,
you can use any letters from the word “function” (as long as they’re in order)
union foo () => ()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.
Nix:
:( although Nix doesn’t allow empty bodies so it won’t build )
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.
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.
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.
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.
While
Cfeels fine without having a keyword for function, I feel likebashwould have benefitted from it.R:
\()new fangled…
basic:
def fnfuncitonIdk why but that’s how I type it half the time.
And you can continue typing it that way for as long as you want if you set up autohotkey to automatically fix your typos.
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?!
So many of my "-tion"s end up as "-tino"s.
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
funcitonI 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.
‘c’ and ‘t’ should definitely be hit with different fingers if you do touch-typing. But with one hand, that’s true.


Fixed. Brought to you by ortho gang.
there’s no ‘i’ on that keyboard?
And two Ls
I bought this yesterday from perplexity.ai

deleted by creator
Won’t you take me to
funcitooon?
Won’t you take me to
funcitoon.
Kotlin seams fun
It is. Also *seems
A pointer?
To a dictionary
Not sure I’d call what bash has functions. They’re closer to subroutines in Basic than functions in other languages, as in you can’t return a value from them (they can only return their exit code, and you can capture their stdout and stderr). But even then, they are full subshells. It’s one of the reasons I don’t really like Bash, you’re forced into globally or at least broadly-scoped variables. Oh, and I have no clue right now how to find where in your pipe you got a non-null exit code.
It’s not a big problem for simple scripting, but it makes things cumbersome once you try to do more.
You’re not forced into global forced variables, but they’re the default. Use the
localkeyword in front of the variable declaration for nicely scoped variable.It’s not that cumbersome to do things like
local date=`date` echo "$date"but in all honesty the syntax sucks ass because it’s not intuitive. If statements suck ass, passing variables has to be done via command line arguments sucks ass, switch statements suck ass, making structured data sucks ass (
jqis nice though).I agree with you that bash really sucks when you get to anything more than 10 lines and at that point I’d take literally prefer Dreamberd.
I didn’t mean that bash has no local variables, but rather that if you want to use a function as such without capturing stdout, you need variables that are scoped across your functions, which is usually global or at least effectively global.
Turns out you can, by using () instead of {} in the function declaration you can run the function in a subshell where changes to variables are scoped to the subshell and functions are local.
That doesn’t help you if you want to get the result of something that happened in the function without capturing stdout, does it?
global variables
vomits
where in your pipe you got a non-null exit code
First thing you want is
set -eandset -o pipefail. That should report the errors in human-parseable form.Second, to capture exit codes from each command/program, you have to run each of them in sequence yourself, connected by pipes that you create via
mkfifo— the same way as you would do it in any other programming environment. Bash’s|pipes are just a convenient shorthand for this,so if you want full control, you have to ditch the convenience.Functions are definitely not subshells in Bash, seeing as anything modifying the environment, like
pyenvand such, is implemented as functions instead of scripts — specifically because functions are run in the same shell instance.Unless ‘subshell’ means something in the vein of ‘like a new shell, but not really’.
Functions are definitely not subshells in Bash
You’re right, my bad, I got this mixed up with something else.
Try doing
cdinside a function and thenpwdin the main script. Does it move the main script too?I’m gonna bet yes for the simple reason that various helper scripts exist that do advanced
cdhistory, with fuzzy search and whatnot, and they can’t be implemented as anything other than functions.
I really like bash when dealing with even somewhat advanced scripting. Like the 300 LOC scraper I have written over the past two days which horribly parses HTML files using grep | sed.
It’s genuinely so much more fun to do this with Bash than, say, Python. I have once written a scraper using Beautifulsoup and I have no desire to do so ever again.
Honestly, only Haskell manages to beat Bash in how satisfying it feels when you manage to get something working well.

Bash has its upsides too, like the fact that it has arrays / lists and dictionaries / hashmaps. In my opinion, it gets iffy though when you need to do stuff with IFS; at that point one might be better off just using specialized tools.
Not saying working bash isn’t good enough, but it can break in very surprising ways is my experience.
Anyone tried lisp? Looks something like this. ((()))()())))
Remarkable how if the parenthesis is shifted from
lambda()to(lambda), people lose the ability to comprehend things.Isn’t it more like
foo(){…}->(define foo (lambda ()))
tbf?In clojure it’s (def (fn [])) or short (defn []).
In Emacs Lisp, you use one of these two:
(defun funcname (arg1 arg2) (+ arg1 arg2))(lambda (arg1 arg2) (+ arg1 arg2))— with the latter typically being an argument to another function or macro.
deleted by creator
Related: Every
Fnkey on a keyboard is a missed opportunity! That’s not fun at all!
Begs the question, what’s the other shift key labeled!
Doesn’t matter: Nobody uses right shift for anything but pinball games!
okay, now i gotta figure out how to start a keyboard rave when i press fn
That’s a cool looking keyboard!
Meanwhile Haskell:
=
\x -> …
The examples on the meme don’t bind any variables. If those are lambdas, the Haskell version is just the
part.I mean if we are talking lambdas the kotlin would just be {}
def ():is pretty niceEdit: also as someone doing a bunch of CI work right now, Bash can GTFO (unless the alternative is whatever Windows is doing)
Nushell is pretty nice. It’s the good parts of “what Microsoft is doing”, i.e. real structured data in a shell-like language and real error handling.
Windows’s powershell has OOP :D
PowerShell seems like what you get when you combine the convenience and accessibility of a Linux shell with the annoying verbosity of Java
Have you tried “Get-ahilariosulylongnounandnoimnotkiddingsomearethislong?”
also better to type with one hand
You QWERTY people…
/jk
Colemak is great though











