It makes it look like they’re just adding random noise to avoid colliding with existing syntax. Maybe they can try a UUID next time…
It makes it look like they’re just adding random noise to avoid colliding with existing syntax. Maybe they can try a UUID next time…
Yeah, I came to Rust from Scala and Kotlin, where equality is default-implemented (for case class
and data class
respectively, which is basically all we ever used), so this meme surprised me a bit.
I do actually like that you can decide a type cannot be compared, because sometimes it really just doesn’t make sense. How would you compare two HTTP clients, for example? But yeah, it certainly is a choice one can disagree with.
I find these videos give a very visual explanation and help to put you into the right mindset: http://intorust.com/
(You can skip the first two videos.)
Sort of when it clicked for me, was when I realized that your code needs to be a tree of function calls.
I mean, that’s what all code is anyways, with a main-function at the top calling other functions which call other functions. But OOP adds a layer to that, i.e. objects, and encourages to do all function calls between objects. You don’t want to do that in Rust. You kind of have to write simpler code for it to fall into place.
To make it a bit more concrete:
You will have functions which hold ownership over some data, typically because they instantiated a struct. These sit at the root of a sub-tree, where you pass access to this data down into further functions by borrowing it to them.
You don’t typically want to pass ownership all over the place, nor do you typically want to borrow (or pass references) to functions which are not part of this sub-tree.
Of course, there’s situations where this isn’t easily possible, e.g. when having two independent threads talking to each other, and then you do need Rc
or Arc
, but yeah, the vast majority of programming problems can be solved with trees of function calls.
The first iteration of the Rust compiler was written in OCaml…
Sorry, I posted the comment, then realized that problem. 😅
Hmm, yeah, I’d use a constructor method:
impl Event {
pub fn new(base_url: String, rel_permalink: String, title: String) -> Self {
let permalink = format!("{}{}", self.base_url, self.rel_permalink);
Self {
base_url,
rel_permalink,
title,
permalink,
};
}
// ...
}
Then you’d instantiate it like so:
let title = node.value().name().to_string();
let event = Event::new(base_url, rel_permalink.to_string(), title);
You don’t want to use exceptions in normal control flow, because they’re extremely slow. Every time you throw
an exception, it has to collect a stacktrace, which is hundreds, if not thousands, of calculations, compared to a handful of calculations for returning a boolean or an enum variant.
I, unfortunately, have to use GitHub at $DAYJOB and this is me. I navigate most of the webpage via the URL bar now.
Basically, let’s say I’m working on a repo github.com/tomato/sauce/
and want to navigate to the Releases page.
Via the webpage:
github.com
into the URL bar.tomato/sauce/
in the list of recent repos, even though it’s the only repo I work on.tomato/
org.tomato/
org.sauce/
repo in the list.Via the Firefox URL bar:
gi→t→s→r→
.I admit, it’s hard to compete with the latter, but I wouldn’t know how to navigate that way, if the former wasn’t so terrible.
I’m curious to see, how long it’ll last. Much like with a support hotline, there’s no directly obvious financial benefit to having such a chatbot, so if the hype has died down and the price is increased, I could see those being axed pretty quickly…
I thought, the +? was going to be a syntax error. 🙃
You could use this crate to build a Rust program which uses the Qt GUI framework and therefore would feel rather ‘native’ in KDE.
But the vast majority of KDE applications continue to be implemented in C++.
I find that difficult. Aside from code reviews, often times your job as a maintainer is:
A required review slows all of these tasks to a crawl. I do agree that the kernel is important enough that it might be worth the trade-off.
But at the same, I do not feel like I could do my (non-kernel) maintainer job without direct commit access…
Yeah, when I then used Visual Block mode to do the multi-line cursor, I realized I probably could’ve selected+yanked it that way, too.
But that is some good info nonetheless. I wasn’t actually aware of the different Visual modes…
That is a very good question. It all started as a dainty test setup, and I guess, we had lost the routine of always scripting hardware setups, because our previous project hadn’t required it.
Obviously, the second-best time to start doing it is now, but I’d need to properly learn one of these first to be able to lead the way on that.
Which collides with me not really wanting to use any of the ones I’ve experienced so far (Ansible, Puppet) in my freetime. 🫠
Doesn’t that just cut one line at a time? Or is this Emacs-like, where it buffers the lines?
That host doesn’t have internet access, though, so installing a different editor wasn’t really an option to begin with…
Recently had to edit the hosts-file on a remote host, and I don’t know if using two proxy jumps to SSH into it broke it, but it just wouldn’t let me select text with the mouse.
I had to duplicate seven lines and edit the IP addresses, and without being able to copy-paste, I already saw myself manually typing it out.
Then I remembered that in Vim, you can do d5↓
to delete 5 lines. Surely that would also work with copying/yanking. And yep, a y7↓
and a p
aste later and I had duplicated the lines.
Then use the multi-line cursor like I routinely do for changing all 7 IP addresses…
…and now I feel like I’ve crossed the line where people will think I’m just a wizard.
Well, to quote the article’s response to that:
Nice idea in theory, but these built in blockers pale in comparison to the real thing.
Vivaldi users point out that the built in blocker is noticably worse than uBlock Origin, with some guessing that Vivaldi doesn’t fully support uBlock Origin filterlists (Vivaldi is closed source, so it’s harder for users to investigate).
Recently saw a streamer talk about this, and not a tech streamer or anything. She didn’t get quite all the details right, but I think that’s the massive fuckup of Google here: If you don’t get the details right, your interpretation is simply that Google is killing ad blocking.
She’s actually using Opera and understands that it’s Chromium-based, so her takeaway was that Firefox might be the only option left.
In that vein, she also talked about how Google Search is now just ads and bad results, and when someone mentioned DuckDuckGo, she responded that she’s been genuinely been thinking about switching.
Like, damn, I know Google is big and this alone won’t kill them. But her talking about it still felt like the initial drop before the rollercoaster goes downhill. I don’t think, I’ve heard a non-techie talk so negatively about Google, possibly ever…
From what I understand, it works like this:
I always hated the implementation for
.toString()
ofDuration
. It gives you a string like that:PT8H6M12.345S
(not a hash)Apparently, it’s an ISO 8601 thing, but what the hell am I supposed to do with that?
It’s not useful for outputting to end users (which is fair enough), but I don’t even want to write that into a log message.
I got so used to this just being garbage that I would automatically call
.toMillis()
and write “ms” after it.Well, and not to gush about Rust too much, but I recently learned that its debug string representation is actually really good. As in, it’s better than my Java workaround, because it’ll even do things like printing 1000ms as 1s.
And that’s just like, oh right, libraries can actually provide a better implementation than what I’ll slap down offhandedly.