These are chat archives for rust-lang/rust

7th
Oct 2015
Erik Hedvall
@Ogeon
Oct 07 2015 00:23
The 0...10 pattern is already a thing in pattern matching, so that's an argument for .... One could argue that the damage is already done. I, personally, like the consistency of using ... for inclusive ranges, but I can see the risk of typos.
panicbit
@panicbit
Oct 07 2015 00:25
Ogeon: That actually makes it even more inconsistent IMO.
Erik Hedvall
@Ogeon
Oct 07 2015 00:25
Why? The range pattern is inclusive, as well
panicbit
@panicbit
Oct 07 2015 00:25
I mean, why did they not choose ".." for patterns?
I suppose because of ambiguity or something like that
Erik Hedvall
@Ogeon
Oct 07 2015 00:26
It's one step from the last number
Like a visual clue that it's exclusive
panicbit
@panicbit
Oct 07 2015 00:26
If they'd now use ... for ranges and range patterns, then it would be absurd to have ... for patterns in the first place
Or at least it would make sense to have .. AND ... patterns
Because ... patterns are exclusive, but ... ranges are inclusive...
Thats confusing
Erik Hedvall
@Ogeon
Oct 07 2015 00:28
I have no idea why they didn't make both, but I guess they focused on stabilizing stuff. ... patterns should be inclusive
panicbit
@panicbit
Oct 07 2015 00:29
Ogeon: They are indeed! Nice!
Well that invalidates my critique
+1 for ... ranges then
(also +1 for .. patterns :P)
Erik Hedvall
@Ogeon
Oct 07 2015 00:30
That's what I mean. Both syntaxes exists and they have sane meanings, so why not fill in the missing parts? :smile:
panicbit
@panicbit
Oct 07 2015 00:31
I agree. I was operating under the assumption that ... patterns were exclusive :P
Erik Hedvall
@Ogeon
Oct 07 2015 00:34
It's easy to explain why we would have .. for exclusive and ... for inclusive, but I think it would be harder to motivate a third syntax. It would be like https://xkcd.com/927/ and cause more confusion than what we would otherwise have. That's why I'm for that as well.
panicbit
@panicbit
Oct 07 2015 00:35
Hm yeah. Since you won't use variables (or collection lengths) in the upper bound of range patterns it's probably natural to use inclusive ranges.
Ugh. I mean. What would it mean anyway if I have a binding like "0 .. x". Would x then be "n + 1"?
Erik Hedvall
@Ogeon
Oct 07 2015 00:37
The pattern came first. The range creation syntax is far newer and it was probably chosen for the x < len convention.
...if I remember correctly
panicbit
@panicbit
Oct 07 2015 00:37
Yeah, I mentioned something like that earlier
Erik Hedvall
@Ogeon
Oct 07 2015 00:38
Yeah
panicbit
@panicbit
Oct 07 2015 00:38
I don't know what the actual reasons are but it's natural to come up with that example
It's what you write all the time :D
Erik Hedvall
@Ogeon
Oct 07 2015 00:40
Exactly. I'm not deep enough into the discussion to know the details, but it seems very probable
Johan Larsson
@JohanLarsson
Oct 07 2015 06:01
is the irc-channel busy?
Johan Larsson
@JohanLarsson
Oct 07 2015 06:22
Any plans for C#-style async?
Peter Atashian
@retep998
Oct 07 2015 06:22
Async is something being worked on in third party libraries
Johan Larsson
@JohanLarsson
Oct 07 2015 06:23
hmm, would expect async to need language support to be nice
Peter Atashian
@retep998
Oct 07 2015 06:23
As that ecosystem fleshes out and people get a better idea of what is a good way of handling async in Rust, it'll eventually move into Rust + std
Johan Larsson
@JohanLarsson
Oct 07 2015 06:23
but of course better if it can be a library fearure
Peter Atashian
@retep998
Oct 07 2015 06:24
Keep in mind that Rust is a native systems language that tries to map closely to OS primitives, yet async models vary quite widely across platforms
Johan Larsson
@JohanLarsson
Oct 07 2015 06:25
yeah, was just curious :)
Peter Atashian
@retep998
Oct 07 2015 06:25
There's not a whole lot of systems languages with async being a core part of the language, and Windows has a wildly different model of async IO than posix
Johan Larsson
@JohanLarsson
Oct 07 2015 06:27
iirc c++17 will have async/await
dunno where I read it
Peter Atashian
@retep998
Oct 07 2015 06:28
There are proposals to add async things to C++
But remember that Rust has the whole lifetime/ownership/borrowing aspects that have to be respected
Johan Larsson
@JohanLarsson
Oct 07 2015 06:29
yeah
Peter Atashian
@retep998
Oct 07 2015 06:29
unlike in other languages where you can either just throw things around due to GC or in C++'s case the language just trusts that you'll get it right
Johan Larsson
@JohanLarsson
Oct 07 2015 06:29
what editor do you use for rust?
Peter Atashian
@retep998
Oct 07 2015 06:29
So it's a challenge to come up with something that is both ergonomic but also efficient
Currently I use notepad++, although I'm moving to Visual Studio as soon as VisualRust gets cargo integration
Johan Larsson
@JohanLarsson
Oct 07 2015 06:30
ah, nice, gonna google that one
Johan Larsson
@JohanLarsson
Oct 07 2015 19:59
can external dependencies be used in the playground?
Peter Atashian
@retep998
Oct 07 2015 19:59
No
Johan Larsson
@JohanLarsson
Oct 07 2015 19:59
ok ty
Johan Larsson
@JohanLarsson
Oct 07 2015 20:44
the rust book is very nice
Johan Larsson
@JohanLarsson
Oct 07 2015 22:31
is there a chapter that shows #[derive(Debug)]?
Nice feature, don't remember seeing it described in the book.