« first day (1771 days earlier)      last day (1711 days later) » 

1:38 AM
/me clicks anyway
 
 
5 hours later…
6:39 AM
Anyone has any ideas as to why trying to `cargo install clap --version 2.33.0` returns "error: specified package has no binaries"? Adding it in my Cargo.toml file causes RLS to error out saying it can't compile it. Lastly, trying to install directly from the Git repo also fails with the same error message:

`cargo install --git https://github.com/clap-rs/clap.git --tag v2.31.2 --features yaml`

(Note there's no v2.33.0 tag in the Git repo).
In my Cargo.toml, I've tried adding clap = "2.33.0" (See crates.io/crates/clap) and also clap = { version = "2.33.0", features = ["yaml"] }, as per the documentation.
I'm getting started with a few things, so I'm not exactly sure what's wrong with this particular crate or what I might be missing.
I haven't had this problem with any other crates (so far).
If anyone has helpful advice/suggestions, please tag me.
 
7:29 AM
@code_dredd clap is a library, it should not provide a binary. This question should answer part of your problem. stackoverflow.com/q/37706999/1233251
 
@E_net4 I had seen that post, but I'm not sure how it was supposed to help me out. Given that it's a library, I was expecting that trying to install it as a dependency for my project would've worked, but it didn't.
Isn't that what adding it to my Cargo.toml as a dependency supposed to do, like I've (successfully) done with other deps?
 
@code_dredd It at least explains that cargo install isn't the right command for adding dependencies to a project. There's a Cargo plugin which gives you cargo add, though I forgot the name.
But yes, that would be the natural way of including dependencies. It might be worth making a complete, reproducible example into a new question.
 
@E_net4 I'm still not exactly clear on what I'm missing here. For example, I added serde = "1.0" to my Cargo.toml file b/c I intend to use that crate, and it works fine. That's a library, too. OTOH, the very README of the clap repo says that just adding clap = "2.33" to your Cargo.toml file should work, but it's not working. Does that clarify?
Well, I thought about it, but it seemed like a full blown question for "Why does adding this to my Cargo.toml file not work?" would be overkill.
 
@code_dredd I'm afraid I can't tell what could be wrong there. That reasoning seems accurate, so there could be something else messing that up. Please consider writing an actual question.
@code_dredd We are proficient at editing questions to shape. If it has long lasting value, we'll find a good title for it.
 
@E_net4 I didn't think this would have long-lasting value (thought it'd be more like a caused-by-typo post), but I'll keep that in mind. Thanks.
 
 
2 hours later…
10:11 AM
How is that a function?
 
@FrenchBoiethios What's wrong with it?
 
10:29 AM
@E_net4 Well, a function with a side effect that depends on the position in the file looks wrong to me. That was a macro before, why did they change that?
 
@FrenchBoiethios How does that have a side effect?
 
Wrong formulation, indeed. The return value depends on the position.
 
Sure, it depends on where it was called. Even this is compile-time information.
The function does not claim to be "pure", only that it's constexpr. :)
 
Would you be fine with a const fn that returns the file name in Rust?
 
@FrenchBoiethios Meh, I don't know... But it sounds weird to say that I'd prefer a macro, right? :)
 
10:34 AM
@E_net4 Nope, that's a right place to use a macro
People tend to expect that a function can be (re)written by an user, while some compiler magic is allowed inside a macro.
 
:think:
Turns out you can rewrite it. The same module provides a means to fetch the context of the call site. en.cppreference.com/w/cpp/utility/source_location/current
They just managed to provide this without macros.
 
 
2 hours later…
12:50 PM
Rust is a terrible language because it makes one an angry developer. Basically every minute I spend with any other language (which is the majority of my time) I constantly wish I could express the solution I just implemented in Rust instead which makes me angry and unsatisfied and I wish the world-domination of Rust would be faster. Much, much faster.
3
 
Aaand to the list.
Sponsored by the RESF.
 
@E_net4 RESF?
 
@PeterVaro RESF
 
@E_net4 ROFL that's absolutely brilliant!
 
1:36 PM
Let's see your CVs.
(Close Votes, not Curriculum Vitaes. No, I'm not hiring)
 
1:47 PM
whose?
 
1:58 PM
@E_net4 Linked in the question you linked.
 
@Shepmaster \o/
 
@E_net4 I still think it's a duplicate of the old question; why not?
 
cargo-edit it is.
@Shepmaster Because it smells like an XY problem.
 
2:13 PM
Why do people keep thinking that sprinkle some threads over their code will magically make it faster?
 
@FrenchBoiethios Because Rust has f e a r l e s s ` ` c o n c u r r e n c y
 
@E_net4 Wow, much powerful! I must use them, indeed!
 
Thrash resources without fear.
 
I do think it's powerful to be able to easily try out threads for a problem. That should let you benchmark and see that it isn't always a good idea
 
@Shepmaster Indeed, at least this ought to bring more notebook examples of how multithreading does not necessarily make things faster.
 
2:18 PM
@Shepmaster Right, but in this very snippet, I'd be VERY surprised that the threads make the code actually faster
 
Speaking of being able to easily try out things, the Rust ecosystem makes it also very easy to try fuzz testing. I am delighted to see it being successful at finding obscure bugs.
 
@FrenchBoiethios agreed, which is why I added that comment ;-)
@Shepmaster Thank you for posting answers which do not cover that question. They all solve a similar problem, when someone writes a parser from scratch, but not the actual problem using nom. The question here targets specifically the usage of nom for such a standard use-case. — Matthias 5 mins ago
And that one isn't worth my time anymore
 
@Shepmaster This answer is actually super clear: stackoverflow.com/questions/26529711/…
 
I'd refrain from posting so many comments at once, a stream of them often gets interpreted the wrong way.
 
And it is perfectly logical: a tokenizer shouldn't know the context (semantic), period.
 
2:23 PM
Let's just vote to close as a dupe of one of those, or just Unclear, considering that they think none of those apply.
 
How would you do that: stackoverflow.com/questions/57573212/…? (flatten a tree)
 
Oh, I just noticed the OP called Nom a parser generator...
The way I see it, they just want someone to write Nom-compatible code for them.
 
@E_net4 this is true
@E_net4 Conversely, I think it'd be annoying to be the OP and get one comment, fix it, then get another comment, fix it, etc.
 
@Shepmaster Such a strange game. The only winning move is not to play.
 
@E_net4 My other "concern" is around deleting comments. I try to break up my comments so that I feel OK about deleting one without losing other useful feedback.
 
2:32 PM
@Shepmaster And I understand the concern. From the perspective of the OP however, I wouldn't be surprised if they felt bombarded.
(not defending this perception at all, but it seems to be the case)
 
@E_net4 no, I agree that's a possible interpretation.
> fn flat (self)
heathens
that space has no right being there
 
ugh
What is this, Haskell?
Regarding the Nom Q, the comments following the OP's does expose our concerns here.
 
2:49 PM
> But why won't someone just write the code for me?
/s
 
I would, but my pay rate as a PhD is a b y s m a l l y h i g h.
</jk>
But none of us work for free! *heads back to contributing to unpaid open-source project*
4
 
3:07 PM
0
A: How do I flatten a recursive structure using recursive iterators?

ShepmasterIt's a good idea to be familiar with common data structures. You have a tree, and there are several ways to traverse a tree. You haven't specified one, so I chose one arbitrarily. The key here is to implement an iterator that keeps track of some state: all of the nodes yet to be visited. On each...

 
@Shepmaster I like your code, it is clear
But like I wrote, that would be easier with generators
 
@FrenchBoiethios HERE IT COMES....
 
@Shepmaster That's not a real "but", your code is the cleanest possible, I think. I just wish that for ... for ... yield were a thing.
 
@FrenchBoiethios sure.
I mean, it's a thing... in nightly ;-)
 
@Shepmaster That has been in nightly, like, forever
 
3:20 PM
Y'know what we could have in nightly? :)
 
@E_net4 GATs :'(
 
@FrenchBoiethios as a ray of hope, async/await is built on top of generators, so hopefully that gets us closer and closer to stable generators
 
We can keep dreamin
@Shepmaster And async trait members will be built on top of GATs :)
 
Needs moar GATs.
 
I'm happy that iterators are getting easier to use. With the impl Trait notation and the iter functions like successors and repeat, and soon the generators, there is much less boilerplate.
 
3:36 PM
@Shepmaster I don't believe this benchmark. Do you?
I'm pretty sure that some important information is missing
 
Aaaand deleted by the OP.
 
> "C++ costs 39 microseconds" You cast to milliseconds, not microseconds.
LMAO
 
Not sure why the updoot tho
 
The OP mistaken microseconds for milliseconds
 
haha
indeed
@FrenchBoiethios I actually did! It wouldn't surprise me if the C++ compiler had some optimization that just threw away all the code
 
3:40 PM
So the Rust code actually ran faster? What a fun twist.
 
@E_net4 That's a matter of allocator, I guess
 
@FrenchBoiethios It's a matter of too many things. ;)
 
@E_net4 well, hard to tell. OP said "1 or 0"
so the C++ might be 999µs
or it might be 1µs
 
It might be just ret
 
and the Rust was 1317µs
 
3:42 PM
@E_net4 Yes, that kind of benchmark is useless...
 
Fastestest code evar
 
_
 
> error: expected expression, found reserved identifier _
 
4:29 PM
Is this really better?
 
Yes, this is blue
 
@FrenchBoiethios oh, right, in that case, nevermind!
;)
It is amazing how SO completely misses the point where it should focus on
idiots.
:D
 
Huh, silly proxy
 
:47090128 I loved that movie!
 
4:37 PM
(and that particular scene as well)
 
I too :)
 
and the answer is, obviously not
 
 
2 hours later…
6:21 PM
rnmrnmrn
 
@E_net4 go on
 
Carry on?
 
7:00 PM
@PeterVaro I do think the blue is better, for psychochromatic reasons, but also for noticability. Blue is a soothing color, and it stands out more from the other UI elements. I haven't read the blog post, so if a reword and recolor is all they're doing then, fine, but why make a big deal?
I'll try to get to the post later. been busy at work
 

« first day (1771 days earlier)      last day (1711 days later) »