|
Generalising the return type of main just got merged: https://github.com/rust-lang/rfcs/blob/master/text/1937-ques-in-main.md
|
# ? Jul 18, 2017 07:33 |
|
|
# ? May 27, 2024 02:36 |
|
That's dumb as hell
|
# ? Jul 18, 2017 16:06 |
|
xtal posted:That's dumb as hell Not really. It makes writing small programs easier and if you don't use it nothing changed for you anyway.
|
# ? Jul 18, 2017 16:24 |
|
xtal posted:That's dumb as hell Do you have any reasoning behind that hot take?
|
# ? Jul 18, 2017 16:27 |
|
taqueso posted:Do you have any reasoning behind that hot take? The cost of calling unwrap or expect once is not worth this oddity which is unique across all programming languages I've used.
|
# ? Jul 18, 2017 16:39 |
|
xtal posted:The cost of calling unwrap or expect once is not worth this oddity which is unique across all programming languages I've used. How do Java, C#, Python, etc. report unhandled exceptions?
|
# ? Jul 18, 2017 17:53 |
|
xtal posted:The cost of calling unwrap or expect once is not worth this oddity which is unique across all programming languages I've used. If you keep defining main() { then nothing will change.
|
# ? Jul 18, 2017 17:59 |
gonadic io posted:Generalising the return type of main just got merged: https://github.com/rust-lang/rfcs/blob/master/text/1937-ques-in-main.md Awesome! This will make writing a lot of small programs and example code much cleaner.
|
|
# ? Jul 18, 2017 18:32 |
|
xtal posted:That's dumb as hell The only thing I saw about it that seemed odd was this line: quote:Therefore I am proposing that all the standard impls' report functions should use 0 for success and 2 for failure. I'm not sure I'm convinced by their explanation on why EXIT_FAILURE shouldn't just be 1.
|
# ? Jul 18, 2017 20:28 |
|
I'm playing with Rocket and Diesel -- they're the first real frameworks I've tried in rust (tokio is probably the largest library I've dealt with). CodeGen and Macros are going to ruin this language. http://docs.diesel.rs/diesel/macro.infer_table_from_schema.html I'm flabbergasted that the compiler even makes this possible. I'm doubly flabbergasted that Diesel presents this in their tutorial as the way to generate their schema.
|
# ? Aug 12, 2017 04:42 |
Is there a good physical book about rust? I learn best just by reading paper.
|
|
# ? Aug 12, 2017 04:58 |
|
MALE SHOEGAZE posted:I'm playing with Rocket and Diesel -- they're the first real frameworks I've tried in rust (tokio is probably the largest library I've dealt with).
|
# ? Aug 12, 2017 06:38 |
|
I think this is a pretty bad idea too but, to be fair, languages like Java do a ton of this stuff at compile time too, e.g. Jooq. What I dislike most about macro based DSLs is that inevitably they will end up like C++-style template monstrosities that are poorly documented and where there is no hope of sane autocompletion.
|
# ? Aug 12, 2017 19:19 |
|
Sagacity posted:I think this is a pretty bad idea too but, to be fair, languages like Java do a ton of this stuff at compile time too, e.g. Jooq. What I dislike most about macro based DSLs is that inevitably they will end up like C++-style template monstrosities that are poorly documented and where there is no hope of sane autocompletion. What concerns me is that rust made this incredibly easy. Yes, I was importing a crate called `_codegen`, which should have tipped me off, but beyond that it's just a macro. If this were enabled as part of a plugin, it would be a different story. Macros should not be able to do this, and now I'm going to have to be incredibly suspicious of every single macro I encounter because it could be doing network insanity at compile time. (I could be mistaken about some of this, I haven't actually figured out how this macro works yet). DONT THREAD ON ME fucked around with this message at 19:59 on Aug 12, 2017 |
# ? Aug 12, 2017 19:54 |
|
MALE SHOEGAZE posted:What concerns me is that rust made this incredibly easy. Yes, I was importing a crate called `_codegen`, which should have tipped me off, but beyond that it's just a macro. If this were enabled as part of a plugin, it would be a different story. Macros should not be able to do this, and now I'm going to have to be incredibly suspicious of every single macro I encounter because it could be doing network insanity at compile time. (I could be mistaken about some of this, I haven't actually figured out how this macro works yet).
|
# ? Aug 12, 2017 20:17 |
|
Ralith posted:"just a macro" can't do this. At a guess, the macro expands to a custom derive, which IIRC can run arbitrary code. Understanding what the macros you're using do is good practice regardless, of course. Yeah, if you look at the source you get this: code:
|
# ? Aug 13, 2017 02:35 |
|
Weird, it never occurred to me that you could use custom derive like that. I assume procedural macros will allow similar behavior? If so I really hope they gate them somehow because I really don't want things like this to be standard macro behavior. But to Ralith's point, it's not like I ever really use a macro without understanding what it does, so maybe it's okay.
|
# ? Aug 13, 2017 22:59 |
|
Procedural macros should generally be the exception, at least once declarative macros 2.0 lands. Hell, any kind of macros at all should be the rare exception, much less complicated ones. It's good to have escape hatches in a language, even if some people will always be tempted to treat the escape hatch more like a revolving door.
|
# ? Aug 13, 2017 23:38 |
|
Ralith posted:Procedural macros should generally be the exception, at least once declarative macros 2.0 lands. Hell, any kind of macros at all should be the rare exception, much less complicated ones. It's good to have escape hatches in a language, even if some people will always be tempted to treat the escape hatch more like a revolving door. I think I've misunderstood the state of macros. My understanding was the procedurals macros were macros 2.0, but it sounds like you're saying that's not the case. Guess I have some reading to do.
|
# ? Aug 14, 2017 00:01 |
|
I think the need for macros will go down a bit once const_fn is stable. Certainly that's what I mostly use them for myself.
|
# ? Aug 14, 2017 11:47 |
|
gonadic io posted:I think the need for macros will go down a bit once const_fn is stable. Certainly that's what I mostly use them for myself. And impl Trait, one of the areas I used macros the most is where I basically wanted to just treat heterogeneous objects as a uniform trait and a trait object was insufficient. (Such as selecting between and initializing different implementations of the same interface based on user input, and then doing the same thing to it regardless). E: Like code:
Linear Zoetrope fucked around with this message at 14:48 on Aug 14, 2017 |
# ? Aug 14, 2017 14:41 |
|
Does anyone know how to test libloading plugins? I have the following sort of thing: [Generic language] -> Plugin Loader/Context manager/etc (extern C no mangle cdylib Rust crate that uses libloading) -> Rust plugins (no mangle dylib Rust crate) I'd basically like to test the Plugin loader, but to do that I need a compiled plugin. I've screwed around with making a dylib plugin_test crate and putting it in dependencies and dev-dependencies, but I've crawled all around the target directory and it looks like if it's written in Rust it's automatically linked statically as a .rlib and there's no .dll/.so/.dylib in sight. Additionally, Cargo doesn't (yet) support test-specific build scripts. It's not the end of the world to write some scripts to run on Travis/Appveyor that manually build a test crate and set some test environment variables, but I was hoping for something a bit more Cargo-friendly.
|
# ? Sep 26, 2017 21:54 |
|
Did a bunch of tutorials and am mostly through the official Rust book. Really liking the convenience of "cargo build" and the .toml file as opposed to cmake, which has been my White Whale for many years because I am dumb and bad. It feels like a compromise between Javascript's npm stuff and C/C++'s make files.
|
# ? Oct 1, 2017 21:02 |
|
Cargo is easily Rust's best feature. Every time I have to dive back into C++ or Python land (and I'm a PhD student doing research work, so a lot of these aren't exactly... iron clad libraries) I end up with weird messes of dependency management. ESPECIALLY around the fuzzy OS-level boundaries where something works on one OS but suddenly the nice pip or setup.py or apt-get dependencies or whatever become a giant nightmare on OS X or Windows or not-Windows or Cent OS (but not Ubuntu) and so on. Rust doesn't prevent this, I've seen a few niche libraries that require some sys-type crates that they could only get working on one or two OS's or require installations of a language that are a pain to properly setup on Windows or something, but the mix of Cargo and Rust's general platform agnostic-ness makes it a hell of a lot less likely, and IME crate maintainers in Rust-land are much more likely to document these idiosyncrasies. Rust isn't a perfect language, but once you learn how to cope with how long you spend before getting a large engineering effort to compile and how to deal with the corner cases where the borrow checker gets really stupid it's one of the most pleasant environments to work in. (Also, I have to at least give a shoutout to Rust having very firm community guidelines wrt kindness, inclusiveness and recent initiatives to get women, transpeople, POC, etc into the core community with things like impl Future. It's really nice to know they're at least trying and it makes getting help with Rust way less draining.)
|
# ? Oct 2, 2017 01:56 |
|
Just wanted to mention that Firefox beta channel now has Quantum, which includes Servo, which means that in a couple of weeks hundreds of millions of people are going to be running Rust code on their desktops all day, for better performance.
|
# ? Oct 2, 2017 02:20 |
|
Firefox has been shipping a Rust MP4 container parser for a while now.
|
# ? Oct 2, 2017 02:33 |
|
Oh, I forgot about that!
|
# ? Oct 2, 2017 02:33 |
|
What do you guys recommend for GUI crates? I've heard good things about using GTK bindings for Rust but since I'm using Windows and MSVC it looks like I'd have to go out of my way to do everything in a separate IDE or whatever. Tried Googling it but I don't see any simple solution, but maybe I'm just bad and dumb. I learned about the Rocket crate recently and think it might be a good exercise to try to do for a web project.
|
# ? Oct 26, 2017 04:32 |
|
GTK bindings don't care what IDE you use, but GTK on windows is pretty terrible. Rust doesn't really have any mature GUI stuff yet; you could try a web UI instead.
|
# ? Oct 26, 2017 04:54 |
|
Non-lexical borrow scopes are finally under review
|
# ? Oct 26, 2017 06:54 |
|
Did anyone itt ever post about ideas for projects to make or whatever? Because I'm looking through the popular crates on crates.io and trying to come up with simple stuff to make for my Github portfolio. Sorry if this is a dumb question.
Love Stole the Day fucked around with this message at 07:07 on Oct 26, 2017 |
# ? Oct 26, 2017 07:00 |
|
Hell yeah. This will get rid of a ton of headache.
|
# ? Oct 26, 2017 07:39 |
|
Love Stole the Day posted:What do you guys recommend for GUI crates? You can still use a binding to QML perhaps (or even to IMGUI if you don't have too many requirements)
|
# ? Oct 26, 2017 14:15 |
|
Kyren (developer on Starbound) did a cool AMA about making a 2d game in rust: https://www.reddit.com/r/rust/comments/78bowa/hey_this_is_kyren_from_chucklefish_we_make_and
|
# ? Oct 27, 2017 07:05 |
|
Has anyone installed rust rls successfully in visual studio code and have the project auto compile and run in any debugger (on windows) ? What Rtfm page did I miss?
|
# ? Nov 21, 2017 19:45 |
|
Rust just got some really sweet enum memory layout optimizations. Highlights:
|
# ? Nov 21, 2017 20:33 |
Ralith posted:Rust just got some really sweet enum memory layout optimizations. Highlights: This is extremely cool!
|
|
# ? Nov 21, 2017 20:45 |
|
limaCAT posted:Has anyone installed rust rls successfully in visual studio code and have the project auto compile and run in any debugger (on windows) ? What Rtfm page did I miss? This is sort of iffy. I feel like everytime I don't use Rust for a couple months and come back to it with VS Code, I have to completely re-set it up from scratch. That and the fact the RLS keeps breaking with nightly's is really frustrating - I'm currently using the JetBrains Rust plug-in to at least more success now.
|
# ? Dec 11, 2017 07:09 |
|
Yeah the intellij plugin is much better right now. RLS will likely be the superior choice eventually but it’s not there yet.
|
# ? Dec 11, 2017 13:30 |
|
|
# ? May 27, 2024 02:36 |
|
MALE SHOEGAZE posted:Yeah the intellij plugin is much better right now. RLS will likely be the superior choice eventually but it’s not there yet. Even that just randomly decides to stop working for even syntax highlighting for me, though. I think I'll go back to Sublime which at least doesn't try for now.
|
# ? Dec 12, 2017 06:29 |