Post AtE1HVulcO3QyRimtU by [email protected] | |
More posts by [email protected] | |
Post #AtE1HCxG6tl4Afk0dk by [email protected] | |
0 likes, 0 repeats | |
A piece of sugar I really wish for in Rust. You know how you can do this?match … | |
Post #AtE1HD53dtzqYrOEnQ by [email protected] | |
0 likes, 0 repeats | |
@mcc What does the block do in the second one? | |
Post #AtE1HDC9DXfSuqhtqa by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 Explain what you mean by "the block". | |
Post #AtE1HDIsoV3VFjrHLU by [email protected] | |
0 likes, 0 repeats | |
@mcc The => { } at the end. | |
Post #AtE1HDOuS5sNYQg5js by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 This is an example, so the code does nothing. In an actual program,… | |
Post #AtE1HDUw5ghFr7Uu8G by [email protected] | |
0 likes, 0 repeats | |
@mcc Well I did assume as much in the normal case, but I was a bit confused how… | |
Post #AtE1HDabkbEY8i9QyO by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 Yes, it would be passed a boolean x which is true if VariantOne was… | |
Post #AtE1HDfZS9CgO6TOi0 by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 If you want to add enough sugar to cause tooth decay, one thing you… | |
Post #AtE1HDlF73jyfh7vY8 by [email protected] | |
0 likes, 0 repeats | |
@mcc I don't read Rust well, but I am very familiar with Swift, which share… | |
Post #AtE1HDrGkeYqyNwjwW by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 yes, i frequently wind up with situations where multiple cases have… | |
Post #AtE1HDxIOFNjH4lYKu by [email protected] | |
0 likes, 0 repeats | |
@mcc To expand on what I said about booleans being special, what if you had THR… | |
Post #AtE1HE2y39v1YfQ5B2 by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 well, then I could do x ? CaseOne(_) | y ? CaseTwo(_) | CaseThree(_… | |
Post #AtE1HEkZR2nTjtou8m by [email protected] | |
0 likes, 0 repeats | |
@mcc I see the appeal there for writing terse code, but also, I feel there is s… | |
Post #AtE1HTiHnosm99rnA8 by [email protected] | |
0 likes, 0 repeats | |
@mcc That sounds like some very saucy syntax. If x is true, what is y?Maybe wha… | |
Post #AtE1HTofQ5zESwqt6m by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 x is true if a case tagged with x ? is true. y is true if a case ta… | |
Post #AtE1HTv32N5gmjpz3Q by [email protected] | |
0 likes, 0 repeats | |
@mcc The ordinal would be so you could do x ? VariantOne(_) | VariantTwo(_) | V… | |
Post #AtE1HU14fxuZ5QenRo by [email protected] | |
0 likes, 0 repeats | |
@WAHa_06x36 I think I might have been suggesting the syntax unclearly. I'm … | |
Post #AtE1HU6kKsRrN1JKHw by [email protected] | |
0 likes, 0 repeats | |
@mcc Oh I see, so you'd basically get a list of "isFirstCase", &q… | |
Post #AtE1HUZSc7Puo4kG2q by [email protected] | |
0 likes, 0 repeats | |
@mcc So you can put a little mini match in your match. | |
Post #AtE1HUzL3u7K6KqvNg by [email protected] | |
0 likes, 0 repeats | |
@mcc So that I could handle the three cases together, and then inside that code… | |
Post #AtE1HVulcO3QyRimtU by [email protected] | |
0 likes, 0 repeats | |
@mcc But this makes more sense if the code that handles the cases is quite long… | |
Post #AtE1Mn5jBO7Th8MesS by [email protected] | |
0 likes, 0 repeats | |
@mcc Here's an ugly wayhttps://play.rust-lang.org/?version=stable&mode=… | |
Post #AtE1MnDAji4g4DqbTs by [email protected] | |
0 likes, 0 repeats | |
@lambdageek Oh, that's… interesting actually.I was thinking about making … | |
Post #AtE1N9m0qr122eJjqC by [email protected] | |
0 likes, 0 repeats | |
@mcc I don't quite catch what you are looking for, but have you tried match… | |
Post #AtE1N9tSPAyEPjngRc by [email protected] | |
0 likes, 0 repeats | |
@oherrala it solves my problem, but there is code duplication and possibly repe… | |
Post #AtE1N9zq1S4gjWmmOG by [email protected] | |
0 likes, 0 repeats | |
@mcc Maybe in that case it's worth doing your own macro. | |
Post #AtE1NA5rf2tZ2Dbame by [email protected] | |
0 likes, 0 repeats | |
@oherrala Maybe | |
Post #AtE1NwTbm4PP5l5ESO by [email protected] | |
0 likes, 0 repeats | |
@[email protected] reminds me of C#'s syntax (i am sure that's where … | |
Post #AtE1NwZzOLVrPY4KP2 by [email protected] | |
0 likes, 0 repeats | |
@puppygirlhornypost2 I don't think I know that syntax… despite having wor… | |
Post #AtE1Nwg11wKjiEt8nQ by [email protected] | |
0 likes, 0 repeats | |
@[email protected] there's a lambda switch syntax in C#, a lot of the pat… | |
Post #AtE1NwmOeDRC21sEk4 by [email protected] | |
0 likes, 0 repeats | |
@[email protected] i'd have to actually think about it. i remember there … | |
Post #AtE1NwsQHoG4Kih38S by [email protected] | |
0 likes, 0 repeats | |
@[email protected] my brain might just be looking at the => though (which … | |
Post #AtE1Nwy5winMcJLZya by [email protected] | |
0 likes, 0 repeats | |
@[email protected] https://learn.microsoft.com/en-us/dotnet/csharp/fundamenta… | |
Post #AtE1Nx5BWMSyyIfF1k by [email protected] | |
0 likes, 0 repeats | |
@puppygirlhornypost2 Oh, wow. This is elaborate. When did they add this? D: | |
Post #AtE1NxXXov9SOFvtEO by [email protected] | |
0 likes, 0 repeats | |
@puppygirlhornypost2 Unless you mean the null chaining operators, which I'm… | |
Post #AtE1O2LfwTd1ItPyvQ by [email protected] | |
0 likes, 0 repeats | |
@[email protected] like C#7 - C#8 | |
Post #AtE1OtKQxp7vcOFEqe by [email protected] | |
0 likes, 0 repeats | |
@[email protected] https://learn.microsoft.com/en-us/dotnet/csharp/language-r… |