These are chat archives for rust-lang/rust

6th
Oct 2015
Johan Larsson
@JohanLarsson
Oct 06 2015 18:23 UTC
Looks like a beautiful language
Johan Larsson
@JohanLarsson
Oct 06 2015 22:07 UTC
I think F# has ^
is also tight syntax, comes up often
panicbit
@panicbit
Oct 06 2015 23:16 UTC
@JohanLarsson There is something like that but the API is still unstable, see http://doc.rust-lang.org/nightly/core/ops/struct.RangeFrom.html#method.step_by
Johan Larsson
@JohanLarsson
Oct 06 2015 23:16 UTC
yep, saw it
panicbit
@panicbit
Oct 06 2015 23:17 UTC
Once the API is settled the discussion about syntactic additions can begin I guess :)
Maybe consider preparing an RFC?
Johan Larsson
@JohanLarsson
Oct 06 2015 23:17 UTC
tricky with 0..10 imo, F# and haskell are inclusive on the 10
iirc D is not
I prefer inclusive
panicbit
@panicbit
Oct 06 2015 23:18 UTC
IMO it matches nicely with the "i < coll.length" idiom
Johan Larsson
@JohanLarsson
Oct 06 2015 23:18 UTC
I see what you mean
panicbit
@panicbit
Oct 06 2015 23:18 UTC
So you if you need to you can write "for 0 .. coll.len()"
Johan Larsson
@JohanLarsson
Oct 06 2015 23:19 UTC
but then again if you introduce something new
also ideal if things can be standardized among languages
How is an RFC created btw? Github issue?
panicbit
@panicbit
Oct 06 2015 23:20 UTC
Yup, PR and template here: https://github.com/rust-lang/rfcs
The README.md should guide you towards a proper RFC
Johan Larsson
@JohanLarsson
Oct 06 2015 23:21 UTC
my esl will prevent me for ever coming up with one :)
Johan Larsson
@JohanLarsson
Oct 06 2015 23:29 UTC
the ship has sailed for inclusive right?
panicbit
@panicbit
Oct 06 2015 23:30 UTC
I remember the time Rust had range(from,to) and range_inclusive(from,to)
Not necessarily
As long as the new syntax/api is backwards compatible it can be added
Also, you could have a "range_inclusive" method like in the old Rust days
Johan Larsson
@JohanLarsson
Oct 06 2015 23:31 UTC
but 0..10 including 10 would be a huge breaking
panicbit
@panicbit
Oct 06 2015 23:31 UTC
Sure, that's why it would need to be a different, but compatible syntax
Johan Larsson
@JohanLarsson
Oct 06 2015 23:31 UTC
0..2..10 would have to be the same of course
panicbit
@panicbit
Oct 06 2015 23:35 UTC
There seems to be an RFC that recommends ... for inclusive ranges: https://github.com/rust-lang/rfcs/blob/master/text/1192-inclusive-ranges.md
(well it also discusses alternatives)
Johan Larsson
@JohanLarsson
Oct 06 2015 23:37 UTC
hmm, the difference between .. and ... is not huge
panicbit
@panicbit
Oct 06 2015 23:37 UTC
It could be easy to misread it
Johan Larsson
@JohanLarsson
Oct 06 2015 23:38 UTC
a--b
also ambiguous
a..b|
dunno
panicbit
@panicbit
Oct 06 2015 23:39 UTC
| could be confusing because of the || syntax for closures
Johan Larsson
@JohanLarsson
Oct 06 2015 23:40 UTC
ah
I don't know any Rust :)
panicbit
@panicbit
Oct 06 2015 23:40 UTC
Do you intend to learn it?
Johan Larsson
@JohanLarsson
Oct 06 2015 23:40 UTC
reading the book for fun
It looks really nice but not sure I will use it much. We are a .net shop
panicbit
@panicbit
Oct 06 2015 23:41 UTC
You said english wasn't your primary language, right? May I ask which language is?
Johan Larsson
@JohanLarsson
Oct 06 2015 23:41 UTC
Swedish
panicbit
@panicbit
Oct 06 2015 23:41 UTC
Ok. I hoped that I could point you to a translation of the book.
Johan Larsson
@JohanLarsson
Oct 06 2015 23:42 UTC
Np reading it
I just hesitate writing stuff on the internet
except for in chats, here I just close my eyes and press enter :)
panicbit
@panicbit
Oct 06 2015 23:42 UTC
I did too but talking in #rust (irc.mozilla.org) helped me in that regard :=
:)
Johan Larsson
@JohanLarsson
Oct 06 2015 23:43 UTC
where do I find discussions for RFCs btw?
I can only see the documents
panicbit
@panicbit
Oct 06 2015 23:44 UTC
I suppose eithe rin the PR or in the attached Issue (linked at the top of the RFC)
Johan Larsson
@JohanLarsson
Oct 06 2015 23:44 UTC
ah, yeah found it
added a comment about a..b|, think it looks somewhat clean
or a..b]