@mint I don't know about Elixir as a whole but there seems to be a lot of bullshit where, like, something is plucked from an implicit expected structure returned by one of the functions in a module, and you have to read the entire call stack because you can't just test it interactively because there are 20 lines of destructive context built up. I think there is a bug in one of the existing uploaders but I don't know if the bug is still there or if I'm reading it wrong.
I don't think the way pattern-matching is used lends itself to code that is easier to read or write or debug or even spot the bugs in. I shit out all those MRFs and a lot of them have comments or commit messages indicating that the code is bad but I eventually just stopped making a note of that because it applies to all of them. Trying to write "good" code to fit into Pleroma has
I say "the way pattern-matching is used" and I can't say for certain whether this has to do with the project or the APIs the project has to use or if every Elixir codebase looks like this. I pretty strongly suspect that this is the ecosystem/language's fault. Phoenix reeks of a design that was conceived by Rails fetishists, and Rails is one of the worst designs you can come up with.
I want to conform to an interface, play nice with the internal tooling, and that's 95% of the effort. The other 5% of the effort is calling two upstream endpoints. I think these ratios are backwards.
@mint That style you can't actually use in Phoenix: it just sends back a 5xx error for things that should be a 4xx. You're supposed to have a lot of these little processes, all of which fit on half a page, and when one of them breaks, it's handled upstream.
@mint Like, I can't actually use this API as-is because it's for shipping JSON around and it silently discards other parameters if you upload a file and it only lets you upload one (so much for the "multi" part of "multipart"): https://git.freespeechextremist.com/gitweb/?p=fse;a=blob;f=lib/pleroma/http.ex;h=052597191fcc90d48641217f6002418462893031;hb=HEAD#l61 . So I have to take a step down and just talk to Tesla and build the multipart request myself if I'm trying to make something you can drop into Pleroma instead of something that requires changes to Pleroma; fine, I don't mind, this is called "programming", I can do that.
Tesla returns `{:ok, {status: whatever}}` as long as the request succeeds, and then you handle the status being 200 or 201 or 401 or what-have-you. That's sensible, that's what you want, you want the client library to tell you that there was an error if the server couldn't be reached or if it responds with non-HTTP shit and that it was fine as long as the round-trip worked out and then 2xx vs. 4xx is application logic.
In a lot of cases, Elixir seems like it's fighting Erlang; it's forcing some infelicities in control flow that end up erasing the niceness you'd get from pattern-matching.
@mint The more I look at this, the more that I begin to think that Elixir is the product of a deranged mind and that the language's reach has exceeded its grasp.
99% of the time that you start second-guessing the language, you're wrong and you just haven't bent your mind enough to see the language from its own perspective. It's like thinking there's a bug in the compiler when you're new to a language: the bug is almost certainly in your program, not in the compiler, and you don't understand the language well enough to have a mental model of the compiler. But when I think "No, Elixir's not terrible, you just need to think harder", I can't shake the memory of seeing ".DS_Store" come out of the zip file from the official distribution and the fact that they keep making minor releases of the language that are completely incompatible with previous versions and the entire deps thing is a goddamn fiasco and I think maybe I'm correct to second-guess the language/ecosystem when I have to hand off happy-path to another function and then handle a bunch of errors inline and then I look to see how other code handles these errors and it just pretends they didn't happen.
> if there was a way to enforce good engineering, there might not have been a need to go past cobol
That's like saying that proper engineering could have gotten us skyscrapers out of balsa wood. A programming language doubles as "substrate for building" and "medium of thought"; it's way more than just good engineering discipline.
> would be funny if this exact issue was the reason a bunch of people are failing to upload their media and not knowing why
I should probably report it but I'd have to dig through the docs more and I'd also have to check to see if it's changed: it might have been completely rewritten by now. (I had to link to the FSE repo, because if it *has* been rewritten then no one would know what I was talking about.)
@p@fsebugoutzone.org@mint@ryona.agency are you really going to judge a language for a library for a proprietaty api that is too complicated so they have to make a giant library in the first place just to do relatively normal rest things with it and then some random fuckers who decide to in their off time (i assume) suck off this giant multinational conglomerate and make a library for them in your weird niche language for free?
> are you really going to judge a language for a library for a proprietaty api that is too complicated
No, I've used S3 libraries in other languages. The rest of the thread is has other thoughts about Elixir.
If you wanna write this code, feel free; I'm not super eager to deal with more Elixir so I was gonna do some sysadmin shit I've been procrastinating about first.
> and make a library for them in your weird niche language for free?
I don't think any design should be immune to critique but as I am also currently writing library code in this weird niche language for free, I feel fine granting myself a license to complain.
> is if err != nil { return nil, err } any better?
Yes. Guard clauses are better than indeterminate levels of nesting. Anyone who has personally encountered "callback hell" can tell you this was true in chodejs (before it came up with one of the dumbest possible ways of doing CSP), same with anyone that had to deal with single-point-of-return languages after Dijkstra wrote that anyone that puts multiple returns in a single function has cooties.
> what happens when you forget to copy paste it once, and no one notices for 6 years?
If you're copying and pasting much, you're doing it wrong. At any rate, pointing out that Go has infelicities doesn't mean anything; any language has infelicities. But some languages are nice and you can write code that you are happy with, and some languages suck and the code looks ugly even if it was written by people that are fluent.
To expand on your point about how we could all get by with COBOL, COBOL does that "ADD 1 TO X YIELDING Y" bullshit and that is verbose and ugly: it's not a matter of engineering discipline, the language is a pain in the ass, and full of boilerplate. All the engineering discipline in the world doesn't make COBOL a nicer language than, say, Forth or even FORTRAN.
@p@i@mint funny that you say that. I was reading some official lecture on programming recently (total noob here) and it mentioned that cobol is a verbose language, with an attached example DIVIDE B BY 7 GIVING A
@irie@i@mint Yeah; part of the design was based on the premise that the symbols would be hard and that making it plain language would allow managers to understand the code. That experiment failed, obviously, but Ada had some success at making sense to non-technical people.