FizzyOrange

joined 1 year ago
[–] FizzyOrange 2 points 3 weeks ago* (last edited 3 weeks ago)

It does still have a traditional assignment operator. You can assign values to mutable variables.

Also I would say let-binds are still pretty much assignment; they just support destructuring. Plenty of languages support that to some extent (JavaScript for example) and you wouldn't say they don't have assignment.

I don't think it affects the ability to overload = anyway. I think there aren't any situations in Rust where it would be ambiguous which one you meant. Certainly none of the examples you gave compile with both = and ==. Maybe there's some obscure case we haven't thought of.

[–] FizzyOrange 22 points 4 weeks ago (14 children)

>= and <= match the mathematical operators. The question you want to ask is why doesn't it use = for equality, and the answer is that = is already used for assignment (inherited from C among other languages).

In theory a language could use = for assignment and equality but it might be a bit confusing and error prone. Maybe not though. Someone try it and report back.

[–] FizzyOrange 5 points 4 weeks ago (2 children)

They've been doing that for about the last 6 releases. I wish they'd fix some of the long-standing annoying bugs like the fact that you can't respect .gitignore and search in a subdirectory at the same time. Or the fact that you can't stage a submodule unless you also have that submodule open.

Or how about a less annoying way to configure Run/Debug than launch.json?

Still, can't complain. It's mostly free and still very good overall. I'll definitely be watching Zed... but maybe not too closely until it supports opening large files.

[–] FizzyOrange 1 points 4 weeks ago

where before we ran into compatibility problems with glibc

I wonder if GNU will ever fix that. Surely at some point they have to say "ok we still think things should be open source but we are going to make it suck a little bit less for people that don't build literally everything from source on their local machine"... right? Ok maybe not.

[–] FizzyOrange 0 points 1 month ago (2 children)

Yes, but I was talking about Linux in general. I'm pretty sure Gnome at least has commercial backing.

And Linux advocate never say "don't use Linux; it isn't a commercial product so it isn't as good as Windows" do they? They say "you're an idiot for using Windows; Linux is better".

[–] FizzyOrange 2 points 1 month ago (2 children)

I think he meant the idea of shaming companies for not donating to things.

[–] FizzyOrange 2 points 1 month ago

No that's a subtly different thing. The storage is a contiguous vector, but because it is a ring buffer there must be one pair of adjacent elements that are not contiguous in memory. That's what that comment is saying.

But because it is only one discontinuity it doesn't affect algorithmic complexity, so it is still O(1) to access elements, unlike a linked list which is O(N).

If you google "circular buffer" there will be loads of diagrams that make it really obvious how it works.

[–] FizzyOrange 2 points 1 month ago (2 children)

Standard ring buffers or circular buffers are implemented as continuous vectors, with a read and write pointer.

Rust's VecDeque is a ring buffer: https://doc.rust-lang.org/std/collections/struct.VecDeque.html

view more: ‹ prev next ›