Ephera
- 14 Posts
- 237 Comments
Ephera@lemmy.mlto Programmer Humor@lemmy.ml•I'm new to using Ruby and this tickled me pinkEnglish0·30 days agoAh, I’m not talking about Ruby, I’m talking about language design in general.
I’m currently mostly doing Rust, so I can only really name that as an example (even though there’s very likely other languages that allow this, too), but yeah, here’s for example the 64-bit signed integer in Rust: https://doc.rust-lang.org/stable/std/primitive.i64.html
That is a primitive type, not an object, so it is exactly 64-bits in size and stored on the stack, not the heap. But as you can see in the documentation, Rust allows for associated function anyways, like for example:
let my_number: i64 = -3; my_number.abs() //returns the absolute value, so 3
That’s because that last call is just syntactic sugar for calling the same function statically on the type:
i64::abs(my_number)
Ephera@lemmy.mlto Programmer Humor@lemmy.ml•I'm new to using Ruby and this tickled me pinkEnglish0·30 days agoBy the way, it isn’t actually necessary for everything to be an object to make this work. The language just has to define
10.whatever()
to be syntactic sugar forwhatever(10)
. Some languages, like Python and Rust, have an explicitself
parameter on their methods to help illustrate this.But yeah, a bunch of languages decided to special-case their objects instead, for whatever reason.
I feel like the LLMs really encourage that, too. They’ll deliver some garbage and then you tell them to make it less garbage and they’ll be like “You clever son of a removed, why didn’t I think of that?”.
I do think, it’s fair to use Python code which uses C under the hood in benchmarks, because it does often match reality. But then it also has to be realistic code. If it’s just a single line of Python code, which calls into C and then everything happens there, then there is really no point for you to use Python.
Python only makes sense to use, if you do write some amount of glue code with it. And then it does require significantly more skill to write performant code than it does with many other languages, as lots of costly abstractions are hidden from you. And it often also requires more effort, since you might not find performant libraries, since so much of the ecosystem only has performance as an afterthought. Reality is messy, which is why realistic Python code still tends to do terribly in benchmarks, whether it calls into C or not.
Ephera@lemmy.mlto Selfhosted@lemmy.world•Leaving GitHub. Seeking ethical music server alternatives.English4·2 months agoI believe, Icecast ticks at least some of your criteria. It’s been around since forever, so it’s probably the most stable option and even a Pi1 is likely overkill for it. No idea how it holds up in terms of UI, app and Docker, though.
They do have a mirror on GitHub, but the main repo is on a self-hosted GitLab.
Ephera@lemmy.mlto Selfhosted@lemmy.world•Leaving GitHub. Seeking ethical music server alternatives.English1·2 months agoYou’d have to rewrite the Git history to pseudonomize the author, which yes, is pretty bad, but I don’t see why you’d need to remove the code, unless they genuinely checked in their home address or such.
Ephera@lemmy.mlto Selfhosted@lemmy.world•KDE Plasma Bigscreen (Android TV alternative) is back from deadEnglish10·2 months agoIt’s a Linux concept. Basically, imagine you could have a Windows 11 PC with the Windows XP GUI or with the macOS GUI. In Linux, these kinds of different GUIs are just desktop environments, which you can install as you see fit.
Conversely, you can also have an OS without a desktop environment, which is basically what’s used on Linux server PCs.
It’s mainly horrid, because it means you have to code extremely defensively (or I guess, use a different API).
You can’t rely onnew Date("not a date")
aborting execution of your function by throwing an error. Instead, you have to know that it can produce anInvalid Date
object and check for that. Otherwise a randomNaN
shows up during execution, which is gonna be extremely fun to try to find the source of.I understand that it’s implemented like that partially for historical reasons, partially because it’s often better to display “NaN” rather than nothing, but it’s still the sort of behavior that puts me in a cold sweat, because I should be memorizing all kinds of Best Practices™ before trying to code JavaScript.
(saying something more realistic like “2015” or whatever your inexperience or AI told you to)
User input is probably the big one where this API is gonna get stress-tested…
Hmm, I can believe that it was based on
java.util.Date
, but I don’t remember that being as unpredictable. I guess, a different API to begin with, would have avoided a lot of problems, though…
Ephera@lemmy.mlto Open Source@lemmy.ml•Codidact - Open-Source Stackoverflow alternative.English10·2 months agoYeah, Lemmy is actually a decent software for this use-case…
The last one seems to be mostly like Brainfuck, just with different capitalizations of “moo”: https://esolangs.org/wiki/COW
It’s the same thing as ternary, just without the
? :
syntax.
Yeah, the wording is confusing. A long time ago, there was no paid software, there was only software where you got the source code and other software where e.g. it was pre-installed on some hardware and the manufacturer didn’t want to give the source code.
In that time, a whole movement started fighting for software freedom, so they called their software “free”.
Ephera@lemmy.mlto Programmer Humor@lemmy.ml•Explaining to your boss how Sr engineers are madeEnglish0·4 months agoThe problem is that corporations are not holistic organizations. In theory¹, a company could not have any juniors and always just hire seniors from the outside. And if your boss has reason to believe that this is more cost-effective, then they have to strive for that, even if they’re well aware that it cannot work when all companies strive for that.
¹) In practice, I’ve actually found that juniors are important, too. If you staff a project team with only seniors, you quickly end up in a situation, where they don’t talk enough to each other. They know how to solve things technologically, so they don’t need to tell each other about their challenges and what solution they chose.
Similarly, you likely end up in a situation, where only big problems are being tackled, because everyone can tackle big problems and they’re just very visible, highly prioritized problems. But when you add up enough small problems, they become just as problematic.
If you run a build command on the CLI, it should tell you the full type names…
The conventional ternary is structured like a normal if-else. In fact, in many languages with functional influence, they’re the same thing.
For example, you can write this in Rust:
let vegetable = if 3 > 4 { "Potato" } else { "Tomato" };
I don’t have much experience with IPv6 yet either, but as I understand, the primary benefit is that you can get rid of a lot of the crappiness of IPv4, which you might just deem ‘normal’ at this point, like NAT and DHCP. It does happen quite a bit, for example, that we’d like a unique identifier for a host, but with IPv4, you need to store a separate UUID to accomplish that.
Ephera@lemmy.mlto Programmer Humor@lemmy.ml•They're trying to normalize calling vibe coding a "programming paradigm," don't let them.English0·4 months agoThe term was coined by an OpenAI co-founder. No idea, if I would call the OpenAI folks “serious”, but it’s not just a derogatory term, like you might think.
I’ve been trying to basically build a library that helps you put together a distribution archive.
And my initial plan for the API looked something like this:
Distribution::new("my-program") .dir("assets") .file("favicon.png", |path| build_favicon(path)); // "|path| ..." is a lambda function that gets the target path passed in
So, it would allow you to define the file structure, and for the parts that actually need to be built, you’d provide a lambda function, which it would automatically run or not, depending on whether the inputs changed.
Right, inputs, what are those? I kind of need my user to tell me. So, I decided to implement the caching as a separate API, which you would call on your own when you get called by the lambda function.
Then I realized, I kind of don’t need the lambda function then. I could just construct file paths and then my user calls their
build_favicon(...)
function or similar on their own.There is just one crucial problem with that. This is what the file API in the stdlib looks like:
PathBuf::new("my-program") .join("assets") .join("favicon.png");
I might not have built anything, really. 🫠