« first day (1924 days earlier)      last day (1555 days later) » 

6:44 AM
@DenysSéguret this doesn't wok for you? In case if you haven't seen this : stackoverflow.com/questions/59247458/…
 
7:04 AM
@ÖmerErden The goal is rather to check and pick, from time to time, what rust fmt would have to change. At this point, most of what cargo fmt proposes me is worse than my code so I want to choose. I probably need a thing which saves the old code, fmt the crate, reverse saved and changed, then open a three ways diff tool like meld to let me pick the changes
 
@DenysSéguret cargo fmt -- --backup does saving the old code
but for diff tool
 
@ÖmerErden thanks
 
I used intellij's compare tool, you can easily revert the changed lines
but i couldn't find any tool to remove bk files automatically
 
When you have the two versions in two directories, any 3ways tool should be ok
BTW how do you know about this --backup ? I don't find it documented
 
> rustfmt --help
 
7:49 AM
@DenysSéguret i couldn't find the reason but somehow they want to deprecate backup flag in rustfmt 2.0 : github.com/rust-lang/rustfmt/issues/3887
this might be the reason that's why it has not documented
https://github.com/rust-lang/rustfmt/pull/3902

"Sorry that the original issue was unclear about my intention, but I would prefer to remove this and make it a hard error rather than keep it."

Maybe they are not aware of your use case which might be useful for users instead of just an internal functionality.
 
8:09 AM
In fact having a bunch of .bk files isn't really convenient. I think I'll just copy the src folder, do the fmt, reverse folders then launch a 3 ways diff tool
 
8:20 AM
Sure, git tools with a ui might help also.
 
8:42 AM
@DenysSéguret cargo fmt -- yourfile ?
or directly rustfmt yourfile
IT'S COLD OUTSIDE
 
9:32 AM
@Stargateur it formats all files from my side ( rustfmt 1.4.8-stable )
 
this tool is so badly coded
 
I have no idea whether this missing feature is due to bad implementation or just a kind of religious view of fmt
 
10:11 AM
@FrenchBoiethios since the comments about dups are removed after the question is closed, adding another comment starting with "TL;DR" feels weird. You should say something like "The duplicate applied to your question:"
 
@mcarton Eh, and that's too late, I cannot edit the comment
 
10:39 AM
TL; CE
 
Too Late; Can't Edit :D
 
Gosh, you're a mind-reader
 
Not really, i have just read both messages concurrently :P
 
 
2 hours later…
12:26 PM
@DenysSéguret what I do is apply changes to the whole project then do git add -pu
Which allows me to add just the pieces of change I want
I usually do this when adding to existing code that needs formatting but I don’t want to change it, but still want my changes to be formatted correctly.
 
I should maybe do this.
 
problem is rustfmt want the valid rust code to work so their parse it entirely
that good, but there should be a way to do a "do your best with only this file"
I often use format tool for know where I must close delimiter
every time rustfmt scream at me where it should help me
 
It has little to do with macros though: he's generating insanely big functions. Had he used an external code generator he would have had the same problems.
 
My point was people use macro wrongly
because macro is generally a bad tool
it's like object
because often use badly OOP
but OOP is not a bad tool :p
 
12:41 PM
Yeah, I stopped reading this thread when I came to the "function with 100 000 LOC". I don't care if rustc isn't fast for such functions
 
Jake Goulding on January 20, 2020

Rust has been Stack Overflow’s most loved language for four years in a row, indicating that many of those who have had the opportunity to use Rust have fallen in love with it. However, the roughly 97% of survey respondents who haven’t used Rust may wonder, “What’s the deal with Rust?”

The short answer is that Rust solves pain points present in many other languages, providing a solid step forward with a limited number of downsides.

I’ll show a sample of what Rust offers to users of other programming languages and what the current ecosystem looks like. It’s not all roses in Rust-land, so I talk about the downsides, too.  …

5
 
function should always (generate or not) have no more then 30 lines
I personally prefer less than 20
 
@Shepmaster you're now a writer in the overflow thing ?
 
@Shepmaster wait wait wait
BTW, soon 200k
 
> it’s extremely common to get errors when compiling your code
Even with "extremely", it sounds like an understatement...
 
12:47 PM
@Stargateur I disagree about the size of generated functions. They are not made to be human readable, so their length doesn't matter much (generally short functions are preferred for maintainability) and it's extremely hard to get tools to understand enough of your code to now how to split it up.
But functions in the 100k of lines are insane and it's obvious that there are limits to the capabilities of the compiler, so I'd definitely blame the generator rather than the compiler if that was slow to compile.
 
The language was designed around functions as a horizon. Their interface is crucial for analysis. This is a design choice which is fundamental in my eye and can't be ignored when generating code
 
> Many statically-typed languages have a large asterisk next to them: they allow for the concept of NULL. This means any value may be what it says or nothing
ah I don't like the mix between NULL concept and void concept
void is nothing not null
 
Oh yeah, I linked to this chatroom from that post, so we gotta be on good behavior :-)
 
null is something
@Shepmaster don't worry no one like SO chatroom so I don't expect more than 2 peoples :p
 
@Shepmaster WHAT ABOUT MY PSEUDO-PRIVACY!!!!?
 
12:52 PM
Totally possible
 
> During early development, these edge cases can often be addressed by causing the program to crash, and then rigorous error handling can be added at a later point.
 
> Coming from garbage-collected languages
do you see where I go with this sentence ?
 
Is this how you code ? I don't really do like this
 
@Stargateur C didn't use to have void* (they used char* for that), and when they felt the need to have "some pointer type pointing to whatever" they probably just reused a keyword that just so happened to be used where types are often used (return "type" of a function) and didn't have any meaning as a pointer yet
 
@mcarton but here you talk about pointer void *
I'm talking about void
! in Rust
@mcarton and again a missconception void * in C is not a pointer to whatever
it's a pointer to nothing
you can't dereference a pointer to nothing
 
12:56 PM
I never called ! "void" in Rust. It's called "never" type in the docs, and "bottom" type in most CS articles
@Stargateur It's not a pointer to nothing. It's a pointer to something you don't know the type of. You can't dereference a pointer if you don't know its type.
 
well call it like you want that the same thing
 
@DenysSéguret I do sketch out stuff with unimplemented!(), yeah
 
well ! is more subtle
 
@Stargateur No it's not. void in C is similar to () in Rust. You can return from a void/() function, you can't return from a ! function.
 
like I said...
 
12:58 PM
@Stargateur I'm not referring to void there though. I'm thinking more like in Java how you have an ArrayList foo. That may be a variable of type ArrayList or it may actually have the type "NULL"
 
@Shepmaster but you said "This means any value may be what it says or nothing"
nothing have a specific meaning for me java or not
 
yep. It's an ArrayList or it's NULL
It's a String or it's NULL
It's a Person or it's NULL
 
but NULL is something ?
well that said option in rust is None
but not Nothing
but I'm not good enough in english to know if there is a difference
 
@Stargateur NULL is the "nothingest" value that a Java type can have though :S
@Stargateur Quand tu as une function qui prend une ArrayList<String> en java, mais que tu lui passes null, c'est comme si tu lui passait "rien". null n'est pas une liste, et bien souvent quelque soit le type de l'argument il faut un cas spécial pour traiter null. null est aussi souvent utilisé pour les paramètres optionnels littéralement comme si null signifiait "rien" et dans les classes, avoir un membre à null signifie souvent que le membre n'est pas présent.
Je pense que c'est ce que @Shepmaster veut dire par rien/nothing.
 
@mcarton Royale with Cheese ;-)
 
1:12 PM
@Shepmaster I hopefully haven't distorted what you meant too much. I just made it all about cheese.
 
@mcarton Nah, according to Google Translate it's reasonable
 
@Shepmaster you don't speak french ?
 
Non
 
@Shepmaster It's usually rather good for French <=> English, it's doing all French highschoolers' English homework after all.
 
with the amount of french here you should give a try :p
are you the typical American that only speak English ? ^^
 
1:19 PM
Sadly, my brain already merged Spanish and Japanese, two unrelated languages.
 
BTW @mcarton even in french I still disagree
 
I can't think what would happen if I tried to add French which at least has similar roots as Spanish
 
@Shepmaster yeah I have the same problem
 
I took Spanish at university because I needed an extra language and was lazy (I took German in high school and regret it because I was too bad at learning languages for this). All I remember from Spanish class is: 1. Spanish conjugation is insane, 2. whatever the teacher says about this, vocabulary is mostly French with o/a at the end, and the rest of the vocabulary isn't worth learning to get a passing grade.
 
"RUBY"
it's the perfect example of good language terrible performance
 
1:26 PM
And now I've been living in the Netherlands for 3 years and still panic and the grocery store when the cashier doesn't ask the same questions in the same order as usual and I don't know what to do.
 
@mcarton use english
nothing wrong to switch when you don't understand a sentence in a conversation
 
@Stargateur I always end-up replying "Sorry I don't speak Dutch" and they always can reply in English, but this shows how bad I am at learning languages (except for English which I've learned by watching TV)
 
but I have something to say about spanish "conjugation" there is not a "conjugation" in spanish ALL VERB ARE IRREGULAR ANYWAY and you know what english is WORSE ON THAT ;)
 
@Stargateur Many verbs are irregular in English, but at least you don't need to learn 10 different grammatical tenses × 6 grammatical subjects
 
@mcarton you know what I wanted to find a list of irregular verb in spanish look like it's doesn't exist I think no one have ever done it :p
I only remember, "como te llamas, me ??? lamo? Stargateur"
and como estas hoy
 
1:35 PM
I remember "Como esta dans la casa?" from the Free ads more than my Spanish classes :D
 
this avatar feel strange
who rip off kurbi's arm ?
and feet
 
@trentcl feel free to downvote my answer in those cases ;-)
 
@Shepmaster Thanks, I figured you would notice pretty quick :)
Thanks for adding the link, I was looking for it
 
@trentcl np, you know I like my cross-links. Feel free to massage it into the flow of the answer or replace my UID with your own :-)
 
> This post has been deleted; deleted posts can't be voted on
damm a miss occasion to downvote shepmaster
 
1:50 PM
@trentcl your answer makes me happy because I was sitting there thinking "this should surely be possible"
 
the downcast from box always get me thinking how it's done
 
@Shepmaster Ok, this is one of those situations I'm not certain about.
Because stackoverflow.com/questions/34922579/… clearly does answer the question, but it's fairly buried in other stuff
 
@trentcl And the question asks about an arbitrary trait object; it wouldnt work for &mut Any though.
 
2:06 PM
oh, hmm.
 
@Shepmaster Box doesn't accept non-static lifetimes ?
 
I'll add the link because it's clearly related
@ÖmerErden Any doesn't
 
@trentcl and the new question is nicely focused.
 
@Stargateur We could always undelete it temporarily, so we can downvote it?
 
@PeterHall this would be too artificial
 
2:13 PM
@Stargateur When will we ever have this opportunity again tho?
 
@mcarton when time will come
 
what is the criteria for undeleting a post?
Is it tag-specific or total rep?
 
@ÖmerErden related, you can only downcast a static dyn any: stackoverflow.com/questions/59476994/…
 
Next episode of the actix drama: a nice end: github.com/actix/actix-web/issues/1289
2
 
2:20 PM
@edwardw I was trying to tell you shouldn't able to box Any at the first place(if it is not 'static), but i've totally misunderstood Shepmaster again, looks like he wasn't talking the question which trenctl answered. I don't know why i do this ^^
 
looks like 20K
 
@FrenchBoiethios now he can create fake user and contribute freely :P
 
@ÖmerErden I think you mean "troll the new maintainer about the use of unsafe" ;-)
 
@Shepmaster I hope that the new maintainer won't treat lightly the UB in the crate.
 
2:36 PM
@FrenchBoiethios It seems likely:
>@JohnTitor wrote...

I think it's worth to fix, re-opening.
 
3:27 PM
@FrenchBoiethios finally some good news
 
@Shepmaster Where did you see that?
Lol: let stops = vec!("the").into_iter().collect();
 
3:48 PM
@FrenchBoiethios that's because they actually want to collect to a HashSet
It's the way I've seen to get thier error
2 days ago, by Stargateur
finally found the sauce https://gist.github.com/pcr910303/d7722a26499d0e9d2f9034a06f2433b4
 
Ah, that's old. Let's see what JohnTitor does
 
I also didn't make the link xd
 
@Shepmaster Wow, I cannot see the word "hashset" anywhere
 
damm I only see new question from RSS feed
and the question just pop
we should have a way to ping SO dev
@SO please 10 minutes for a RSS feed is too much !
 
I don't think having people rush on a question that was just asked is very useful anyway
 
3:56 PM
rush a question is stupid
 
@mcarton We should all have our own randomised delay before seeing the question
 
I'm the dupe. The dupe of love.
 
@Stargateur I've worked with binary protocols where I literally didn't care about parts of the data (but I knew how big it was). This seems to be one of those case. — mcarton 7 mins ago
I didn't question the purpose
 
@PeterHall At least it would give us time to see the question before Shepmaster answers/closes it :D
 
but if the skip doesn't depend on the read Shep answer is a good answer
but OP tell "arbitrary number" so I somehow forget about seek
 
3:58 PM
It's one of those cases where specialization would've been nice to have: use seek if it's available, read and discard otherwise.
 
@E_net9isdisappointedinSE I don't disagree with the dupe, but does it adequately say "hey, use Seek"?
 
I don't fully agree with the duplicate
 
Observers may note that I wrote the answer with Seek, then added the sink() version, then deleted the sink() version when I found that Q, all before ever reading the comments on the OP :-)
so it might count as independent decision making
 
@FrenchBoiethios yep, cause it's not there. It's a superpower I have for guessing :-) But I wouldn't change it because it's such a big guess
 
4:07 PM
I don't know if that's a popular opinion, but there should be a building macro for each collection
let a = hashset![] is much cleaner than let a: HashSet<_> = vec![].into_iter().collect()
 
I'm not sure
iterator should be preferred to build a collection when possible
 
At least, that better express the meaning
@Stargateur Source?
 
@FrenchBoiethios me ?
that was an opinion xd
 
We're talking about literal members here
 
@FrenchBoiethios Because ZCAs yo :>
 
4:09 PM
I also don't know about that. It can be in a crate. How often do you need to construct a collection other than Vec from a known list of values?
 
My suggestion:
fn main() {
    let s: Vec<_> = seq!(1, 2, 3);
    println!("{:?}", s);
    let s: BTreeSet<_> = seq!(1, 2, 3);
    println!("{:?}", s);
    let s: HashSet<_> = seq!(1, 2, 3);
    println!("{:?}", s);

    let s: BTreeMap<_, _> = seq!(1 => 2, 3 => 4);
    println!("{:?}", s);
    let s: HashMap<_, _> = seq!(1 => 2, 3 => 4);
    println!("{:?}", s);
}
 
@mcarton some time I have this problem with VecDeque
 
@Shepmaster That's a great idea IMHO
 
but vecdequeback! vecdequefront! seem ... a lot
 
@Stargateur what change would back / front make here?
 
4:11 PM
but I hardly see any situation where this would be useful for hashmap
 
@Stargateur but this macro is only useful for literal definitions of the collections
so you could just do
let vd: VecDeque<_> = seq!(1, 2, 3); // front
let vd: VecDeque<_> = seq!(3, 2, 1); // back
 
I'm unsure what implication that would be for internal data
but yeah you are right
guess back should be the default
 
FWIW, I'd write your code currently as
let inputs = VecDeque::from(vec![1, 2, 3]);
let inputs = VecDeque::from(vec![3, 2, 1]);
Like, I'd just assume that's zero-cost to transform to a VecDeque
 
should be ok
 
Actually, with the by-value iteration of arrays, there's no need for any macro: Vec::from([1, 2, 3]) or HashSet::from([1, 2, 3])
 
4:18 PM
damm this kind of code is so hard to find with rust
we always forgot trait like from
 
@FrenchBoiethios that's how my macro is implemented ;-)
 
@Shepmaster With the From trait, the macro is a bit useless
 
but there's arguments about if we can make that change backwards-compat tho
 
@Shepmaster Rust 2.0 Rust 2.0 !
 
@Shepmaster Come on, if there is one backwards incompatible change that worth it, that's this very change
 
4:21 PM
I'm sure @LukasKalbertodt could give us an earful about it :-)
 
I've been waiting for this feature for years now
 
4:37 PM
@FrenchBoiethios I sure hope so!
My current plan is to run crater on the regressions again this or next week. Then on the 31st Rust 1.41 (or so?) is released which contains the related lint. Then this lint can bake on stable for 2 or 3 cycles and then we should be able to talk about this again.
 
@LukasKalbertodt Thanks for you work!
 
I still think we should stop say rustc follow semver :p
not that I don't like this kind of change of breaking
actually I think we never talk about that here
 
"non-breaking changes" are an illusion
@FrenchBoiethios I just want those damn iterators already!
 
@LukasKalbertodt lunchtime doubly so
 
@Shepmaster Lunchtime is an illusion?
Dinnertime in Central-Europe!
 
4:51 PM
 
@Shepmaster Ah. Didn't know that quote.
 
Didn't know as well
That's deep BTW
 
Gotta swallow the truth sooner than later: "breaking change" is closer to an opinionated spectrum than a hard fact in practice.
Kinda like in quantum physics.
 
@E_net9isdisappointedinSE You cannot use something more complicated to explain something simpler -_-
3
 
@FrenchBoiethios I can't? Try me. :)
 
4:58 PM
Sorry, in French, "you cannot" can mean "you shouldn't" in this context. Wrong translation.
 
Anyways, that's not my point. Semver does become more complicated when we want it to be practical and widely spread.
That's because it's up to us to define what makes a breaking change big enough to warrant a version bump, and humans are complicated.
 
I have a simple definition, is my code still compile and work as expected?
 
The blunt strategy of making any kind of breaking change a major version bump is not feasible, not very practical, and we'll often lose the benefits of semver if we keep doing that.
 
that the very definition of semver - -
and its very purpose
I don't follow you at all
 
You'll find that many people do follow what I just said. Starting with the Rust developers.
 
5:02 PM
yeah I already have an argument with some people on reddit
 
@Stargateur "expected" is a tough one :-)
Which I'd say makes it not simple
 
as I said I don't care what people think, breaking change are clear for me
@Shepmaster well yes because that can't be verified by compiler
people in Rust are so afraid of breaking that they use stupid trick, or lie and say "no it's not a breaking change"
 
Rust API evolution, as proposed in RFC 1105, allows for "very shallow" breaking changes on a minor version bump.
 
As I said I'm not again small change, or even big one
but stop saying it's semver
> This does not mean that the standard library should be completely free to make non-semver-breaking changes;
> Both Rust and its library ecosystem have adopted semver,
just stop this lie
 
That's a strong wording against me just stating facts, lad.
 
5:07 PM
I'm saying this again everyone not you
You didn't write this RFC anyway... I think
 
I ain't reading all that thread. :[
 
I was just looking if it was you who write it I didn't read either
 
 
4 hours later…
9:08 PM
> I hadn't though of using new
whuh
 
9:24 PM
 
this is a bad use of this meme
1/5
 
.. What?
 
9:43 PM
Stargateur is right. It's not a good use of the meme
I mostly wanted the "Am I a joke" line
Slightly more correct
 
That's pretty hilarious, now.
 
much better :p
 
no new rating?
5/7 now, I think
 
4/5
@Shepmaster internet would say 9/11 but... :p
 
10:00 PM
that's a really nice SO blog post for a change
 

« first day (1924 days earlier)      last day (1555 days later) »