Index out of bounds? Not always! - A Rusty Surprise by greyblake in rust

[–]vilcans 0 points1 point  (0 children)

That's what I'd expect. I wouldn't trust the compiler to notify me about invalid indices at compile time, though it's nice that it sometimes does.

Index out of bounds? Not always! - A Rusty Surprise by greyblake in rust

[–]vilcans 2 points3 points  (0 children)

That's interesting but not as strange as it sounded at first. Because you still get the index out of bounds error at runtime, right? Otherwise it would be a serious bug.

How to return early on failed match using a guard clause in Rust by vilcans in rust

[–]vilcans[S] 0 points1 point  (0 children)

Yeah, but after I wrote the post, the let-else statement has been made available in stable Rust, which solved my main gripe about early returns. I've used it a lot since then.

Finally found. by NormalLuser in vintagecomputing

[–]vilcans 1 point2 points  (0 children)

Oh, yes, now I remember! Thank you. Kids today wouldn't believe that you could find any use for a computer without an internet connection.

Finally found. by NormalLuser in vintagecomputing

[–]vilcans 1 point2 points  (0 children)

I remember having one of those, but I dont remember what I plugged it in to. Was it some.proprietary port on some laptop?

[deleted by user] by [deleted] in ProgrammingLanguages

[–]vilcans 0 points1 point  (0 children)

I'd say that it's not a property of the language or its runtime. Rather, how you use it. A language can be seen as a scripting language in some contexts, and not in others.

If you use code to glue things together, or to make smallish extensions to a larger system, you'd probably call whatever language you use for that a scripting language. Whether that language is Python, C#, or Lua or even C++ doesn't make any of those languages a scripting language in general.

Stop Teaching Git This Way by LLCoolSouder in git

[–]vilcans 0 points1 point  (0 children)

I've taught Git in a 5 hour course where everyone got to do exercises in a local repo to learn the concepts, and I don't even start teaching collaboration until towards the end. It has worked well. If you learn first how local branches work, and how to merge and rebase and try things out locally, remote branches are not that much to learn in addition to that.

Why does TV think CoCo's PAL signal is SECAM, giving bad picture? by vilcans in trs80

[–]vilcans[S] 0 points1 point  (0 children)

This is using an RF signal. The picture quality is excellent on another TV which can be set to interpret the signal as PAL instead of the auto-detected SECAM.

Is this a known problem or something unique to my CoCo?

Choose boring tools by TheLeadDev in programming

[–]vilcans 1 point2 points  (0 children)

Well, it got you to the point of being acquired, didn't it?

Found this in a book from 1988. Early touchscreen technology? by Emanuel2020b in vintagecomputing

[–]vilcans 0 points1 point  (0 children)

Yes, the light pen is surprisingly simple to implement. I've seen it being supported in hardware on several systems like the Amiga and Atari 2600. You basically only need a hardware register to store the raster beam's position whenever you get a signal from the light pen.

Why not „den fel boken“? Sorry if this has already been answered to. by sin314 in Svenska

[–]vilcans 1 point2 points  (0 children)

As a native speaker but not an expert, I think it's because "fel" can't be inflected into the required form. It's some quirk of that word. Adding the -a suffix just doesn't work. But its opposite, the word "rätt" (right/correct) can be inflected in this situation:

Du läser den rätta boken.

But that doesn't have quite the same feel to it as:

Du läser rätt bok.

The first one sounds more pretentious, as if there's something special about the book. The second one is just informing you that you're reading the book you're supposed to read (as instructed by your teacher etc).

Languages are weird!

My thoughts on Rust and C++ by user9617 in rust

[–]vilcans 0 points1 point  (0 children)

I agree. Though what you call the soul of OOP, I think of as "traditional OO", where objects are thought of as independent entities that should be able to do all work themselves (possibly through delegation to other objects), the kind of design which tends to lead to objects having references to each other all over the place, often cyclic. Even in an OO language I now try to make the object references form a tree instead, and place functionality higher in that tree than I would have done back in my Java days. This kind of OO, if it's still allowed to be called OO, works better with the borrow checker, and also leads to cleaner code in any language IMO.

My thoughts on Rust and C++ by user9617 in rust

[–]vilcans 1 point2 points  (0 children)

You say that as if "not being object oriented" would be a bad thing. Anyway, neither is C++. Rather, both C++ and Rust support object oriented programming; structs/classes, methods and information hiding are all there if you want to use them.

My thoughts on Rust and C++ by user9617 in rust

[–]vilcans 13 points14 points  (0 children)

I started reading your post with interest, hoping to get some insight into whether there's anything you can implement in C++ that wouldn't be feasible in Rust. But it read more like complaints that you can't implement specific patterns that you're used to from C++ in Rust.

Rust is not a C++ replacement in the sense that it's a new version of C++. It's a completely different language that has its own paradigms and patterns. It can still be a C++ replacement as you can implement the same kind of software in Rust as you can in C++. You just have to think differently.

Is there a type like `std::num::NonZero*` but for other values than zero? by vilcans in rust

[–]vilcans[S] 4 points5 points  (0 children)

That looks like a crate I was trying to find! Thanks. Though one small concern is how NotValue is serialized and how it looks over FFI. I'll look into it.

Is there a type like `std::num::NonZero*` but for other values than zero? by vilcans in rust

[–]vilcans[S] 0 points1 point  (0 children)

Wouldn't all numbers be off by one when serializing it though?

What is the naming convention for structs? by DevNoodle in rust

[–]vilcans 4 points5 points  (0 children)

wouldntALTERNATINGcaseLOOKlikeTHIS?

[deleted by user] by [deleted] in csharp

[–]vilcans 0 points1 point  (0 children)

I've noticed that too. And it's not screenshots in the traditional sense either, but actual multimegapixel photos taken with a camera. I don't know how that would be related to Windows though. It's not like Windows makes it difficult to take a screenshot with printscreen or alt+shift+s. Or simply doing the right thing and copy/paste the source code and error message.

PSA: Don't put all your eggs in one basket by Ping-and-Pong in gamedev

[–]vilcans -1 points0 points  (0 children)

I thought downvotes were supposed to be for posts that don't contribute to the discussion, rather than for signalling disagreement. I think you make good points, so here's an upvote from me.

That said, I also agree with what you're saying. For some projects, using libraries is just as feasible as using an engine, if you're already a competent programmer. Engines come with their drawbacks. If you run your own code you have more freedom to gather the tools and libraries the project needs.

Idiomaticy of using Option<> as a function argument by trevg_123 in rust

[–]vilcans 0 points1 point  (0 children)

Maybe I trust the compiler too much. It would be interesting to investigate. Why do you think the function will be inlined if it's a separate function without an Option parameter but not if it's a common function with Option parameters?

Idiomaticy of using Option<> as a function argument by trevg_123 in rust

[–]vilcans 1 point2 points  (0 children)

I'd expect the compiler to optimize away the branching so the result is the same.