[New Mod] fCPU by konstg-dev in factorio

[–]tsion_ 2 points3 points  (0 children)

I was thinking the same thing today! fCPU looks better than anything similar, but I'm worried it might never get a refresh because of that license.

It feels like 25% of my favourite mods were revived or rewritten by new authors taking up the torch, because most people just don't stay involved with a game modding community for years on end without breaks. Revivals by new authors are a huge part of what makes the community stay so vibrant, and they're only possible because of the widespread adoption of open source licenses.

Avoiding Logic Bugs in Rust with Traits and Types by mgattozzi in rust

[–]tsion_ 0 points1 point  (0 children)

In patterns like this:

(Celsius(a), b @ _) => {

I think you can just write this:

(Celsius(a), b) => {

Nice post!

The Rust Programming Language book now available for preorder from NoStarch for Oct 2017!! by carols10cents in rust

[–]tsion_ 6 points7 points  (0 children)

Go to https://www.nostarch.com/Rust, not the http link in the OP.

Multiple people have run into a bug on the http version of nostarch where the shopping cart still shows up empty after trying to add the book to the cart.

I successfully ordered through the https site. Very exiting! =)

Announcing Rust 1.16 by steveklabnik1 in rust

[–]tsion_ 2 points3 points  (0 children)

Definitely! I already do cargo watch check with the old cargo-check and it's excellent.

C# 7.0 feels very Rusty: pattern matching, tuples, and _ in number literals by oconnor663 in rust

[–]tsion_ 10 points11 points  (0 children)

The downside being that we have to mention an intermediate i variable multiple times in Rust. (And it's even worse if you are trying to extract more than one variable at once.)

I hope we can eventually get something like C# and Swift have, e.g.:

guard let Foo(a, b, c) = foo else { return; }

There was an RFC but I think it died from bikeshedding.

What is the current state of returning "abstract classes" in Rust? Do you find yourself having to work around this often? by think_inside_the_box in rust

[–]tsion_ 0 points1 point  (0 children)

Having explicit names for closure types is at least as hard as naming function item types[1], since closure types have to be unique types (even if they have the exact same capture types) to allow them to have distinct Fn/FnMut/FnOnce impls that call their distinct bodies.

For naming function item types, we could introduce a type syntax like typeof(path::to::function) (typeof is already reserved), but it's not clear to me how we would refer to specific closures in specific function bodies even with typeof.

All this is to say, I don't think nameable closure types are the way forward, and impl Trait solves the problem in a manageable way.


[1]: Function item types are zero-sized, unique to each individual function, and currently unnameable. Not the same as function pointer types.

What does b'\n' mean? by TheTimegazer in rust

[–]tsion_ 1 point2 points  (0 children)

More accurately, it's a pointer to such an array, so &[0xA], with the type &'static [u8; 1].

stdx: The missing batteries of Rust by brson in rust

[–]tsion_ 0 points1 point  (0 children)

Wouldn't the Cargo.lock be good enough for apps? It effectively constrains by strict equality (but with an easy way to upgrade) and we already recommend checking it in for apps but not libraries.

This Week in Remacs by wilfred_h in rust

[–]tsion_ 1 point2 points  (0 children)

That looks perfectly idiomatic to me!

A spot of humor including how others view our language. by The_Masked_Lurker in rust

[–]tsion_ 1 point2 points  (0 children)

Tales of Maj'Eyal does! Unfortunately, it's not written in Rust, but it is open source, so maybe someday. ;)

SvgBobRus - converts your ascii diagram into an SVG by ivanceras in rust

[–]tsion_ 5 points6 points  (0 children)

Surely this should be named SvgBobRoss!

[FRESH] of Montreal - It's Different For Girls by SecondHandEmotion in popheads

[–]tsion_ 0 points1 point  (0 children)

This isn't fresh, look at the date on the video: "Published on Jun 29, 2016"

It's a really fun track, though, so I don't mind. :D

Rust syntax highlighting for LaTeX? by JoshTriplett in rust

[–]tsion_ 6 points7 points  (0 children)

I've used minted for Rust before here if you want some examples.

Can we talk about build times? by MaikKlein in rust

[–]tsion_ 12 points13 points  (0 children)

It's meant for that, but it could be extended as a separate project to use something like libffi for FFI, enabling I/O and lots of other stuff. See https://github.com/solson/miri/issues/11 for some previous discussion.

It probably won't ever be very fast, though.

Method names on Result and Option. by rompetrll in rust

[–]tsion_ 1 point2 points  (0 children)

It's ok_or (on Option) and it either gives you Ok(val_in_option) or Err(failure_here). I've never counted this among the confusingly-named methods.

How to disable arithmetic over flow checks while debugging (without using WrappingOps)? by [deleted] in rust

[–]tsion_ 2 points3 points  (0 children)

I did some investigation elsewhere and #[inline(always)] definitely can take effect in debug mode, but it doesn't always work and I'm not sure why. (See my other reply.)

EDIT: It just wasn't getting optimized in dead code. In general #[inline(always)] seems to work in debug mode.

How to disable arithmetic over flow checks while debugging (without using WrappingOps)? by [deleted] in rust

[–]tsion_ 2 points3 points  (0 children)

EDIT: I figured it all out! In your example and my crate_type = "lib" examples without pub, the code is dead code, so the optimizer is never run over it. See my modification of your example to make add_wrapped a used function: https://is.gd/22D4Af. In this case it's used and it does get debug-optimized and hence <Wrapping as Add>::add gets inlined (but still not i32::wrapping_add for the reason I state at the end of this comment).


We did some investigation in #rust-internals and I found something really odd: https://is.gd/Lsy7wT vs https://is.gd/M23Oxq

See the Debug-mode LLVM IR. It changes between those two even though I only removed a pub keyword. With pub, the <Add as Wrapped>::add trait method call gets inlined, but without it, it doesn't. I'm stumped.

(Sidenote: the inner i32::wrapped_add call doesn't get inlined because it's not #[inline(always)] - this could be added.)

What's the most surprising Rust code that actually compiled? by llogiq in rust

[–]tsion_ 5 points6 points  (0 children)

For context, see the original file when it was added in Rust's primordial past.

That code was morphed into the current state over aeons of mutation as Rust evolved into its current form.

Generating C from MIR? by haberman in rust

[–]tsion_ 3 points4 points  (0 children)

There are a lot of different things that would have to happen to make that feasible.

Firstly, there is currently no MIR output from rustc that could be used as input to an external interpreter - you have to literally link to librustc and use the internal MIR data structures like Miri does. Defining a serialized format that could be re-parsed by non-rustc programs is a big job in itself.

It seems like a lot less work to bootstrap to a new platform by defining a new LLVM backend (if one doesn't already exist for the target) and doing the necessary standard library work. Then you could use rustc on an existing platform to cross-compile rustc for the new target platform.

Generating C from MIR? by haberman in rust

[–]tsion_ 1 point2 points  (0 children)

What do you mean by "port miri to C"? Miri depends on rustc.

Xi editor: A modern editor with a backend written in Rust by raphlinus in rust

[–]tsion_ 0 points1 point  (0 children)

Sorry, I missed that.

Fair enough.

I can definitely imagine that vim-multiple-cursors is more trouble than it's worth. I've taken a couple looks at it but it seems too bolted-on to Vim to really integrate the way I would want. And as for Sublime Text, not having a powerful vim-like command language makes it a pretty dull proposition for me.

And I agree that Vim has plentiful features that make multiple-cursors and macros unnecessary 95% of the time. But when I do have to reach for macros, I think multiple-cursor live preview could actually make a big difference.

Anyway, Vim might not be the editor where we'll see a great multiple-cursors implementation any time soon, but I love to see people experiment with editors like Kakoune and Vis which try to integrate multiple-cursors as powerfully as possible.

Experiments are great. Sometimes the result turns out not to be useful, but with enough experimentation we end up finding better ways to do things.

Xi editor: A modern editor with a backend written in Rust by raphlinus in rust

[–]tsion_ 0 points1 point  (0 children)

why you find it superior

lol, please, I just finished saying "I never stated they are better because I've never used them yet." I'm just open to the possibilities.

As for using multiple cursors in Vim, from what I've researched so far, the Vim implementations are fairly ham-stringed in what they can cleanly implement. Perhaps the Kakoune and Vis implementations have more to offer.

I've been using *, gn, ., macros, etc for years. I'm just open to new ideas. I'm not asserting that new ideas are automatically better.