Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread comex
On Sat, Mar 29, 2014 at 12:41 AM, Daniel Micay wrote: > A lot of code in the compiler simply leaves out error checking and > relies on getting an ICE from the failure. It would take a long time to > translate everything into proper error messages. Well, a compiler should not intentionally ICE in

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Jared Forsyth
WOW procedural macros! Hadn't seen before that rust has those. that's so cool ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Daniel Micay
On 29/03/14 12:36 AM, comex wrote: > On Sat, Mar 29, 2014 at 12:19 AM, Daniel Micay wrote: >>> This is unfair. You're mixing up static checks such as >>> exhaustiveness, freezing, and lifetimes, which have no performance >>> impact (or at least, the performance impact caused by their >>> limitati

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread comex
On Sat, Mar 29, 2014 at 12:19 AM, Daniel Micay wrote: >> This is unfair. You're mixing up static checks such as >> exhaustiveness, freezing, and lifetimes, which have no performance >> impact (or at least, the performance impact caused by their >> limitations would be mitigated only by fundamenta

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Daniel Micay
On 29/03/14 12:10 AM, comex wrote: > On Fri, Mar 28, 2014 at 8:14 AM, Daniel Micay wrote: >> Lifetimes serve no purpose other than to prevent the programmer from >> doing stuff, and are *entirely* stripped out before code generation. Do >> you want to override/disable borrow checking and freezing

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread comex
On Fri, Mar 28, 2014 at 8:14 AM, Daniel Micay wrote: > Lifetimes serve no purpose other than to prevent the programmer from > doing stuff, and are *entirely* stripped out before code generation. Do > you want to override/disable borrow checking and freezing too? > > There's also the exhaustiveness

Re: [rust-dev] Could the mailing list send digests by time rather than volume?

2014-03-28 Thread Brian Anderson
It looks like I can set the digest size threshold very large and then force it to be sent every day when it never hits that threshold. I'll try. Let me know if anything breaks. On 03/28/2014 09:43 AM, Steven Stewart-Gallus wrote: The recent giant discussion over unsafe bounds checking highligh

[rust-dev] Could the mailing list send digests by time rather than volume?

2014-03-28 Thread Steven Stewart-Gallus
The recent giant discussion over unsafe bounds checking highlights the need for this. Instead of sending digests every few letters digests should be sent every day or so. Thank you, Steven Stewart-Gallus ___ Rust-dev mailing list Rust-dev@mozilla.org htt

Re: [rust-dev] Proposal: a moratorium on adding unsafe features to the safe subset of Rust

2014-03-28 Thread Patrick Walton
I'm uninterested in features that make Rust memory unsafe outside of the "unsafe" sublanguage, and so (as I said in the thread) I am strongly opposed to the noboundscheck flag or any other similar features. Patrick On March 28, 2014 8:12:36 PM PDT, Tony Arcieri wrote: >I really love the semant

Re: [rust-dev] Proposal: a moratorium on adding unsafe features to the safe subset of Rust

2014-03-28 Thread Tony Arcieri
Exactly what I wanted to hear ;) On Fri, Mar 28, 2014 at 8:26 PM, Brian Anderson wrote: > I appreciate your concern, but I don't think a moratoreum is necessary; > memory safety is parament to Rust, so the idea of adding 'unsafe features > to the safe subset of Rust' is an oxymoron. > > > On 03/

Re: [rust-dev] Proposal: a moratorium on adding unsafe features to the safe subset of Rust

2014-03-28 Thread Brian Anderson
I appreciate your concern, but I don't think a moratoreum is necessary; memory safety is parament to Rust, so the idea of adding 'unsafe features to the safe subset of Rust' is an oxymoron. On 03/28/2014 08:12 PM, Tony Arcieri wrote: I really love the semantics of the safe subset of Rust. Rec

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread comex
On Fri, Mar 28, 2014 at 10:43 AM, Peter Marheine wrote: > On Fri, Mar 28, 2014 at 9:30 AM, Jared Forsyth wrote: >> Is rust's macro system powerful enough to do calculations, such that you >> would be able to guarantee that the provided patterns were exhaustive? >> From what I've seen, the macro s

[rust-dev] Proposal: a moratorium on adding unsafe features to the safe subset of Rust

2014-03-28 Thread Tony Arcieri
I really love the semantics of the safe subset of Rust. Recently there has been a call to introduce an optional feature flag which removes bounds checks to the *safe* subset of Rust (i.e. outside of unsafe blocks) I think this sort of suggestion imperils Rust's goals as a language. Adding off sw

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tony Arcieri
On Fri, Mar 28, 2014 at 6:55 PM, Daniel Micay wrote: > You can already use unchecked indexing in any case where there's a > performance issue so I don't really understand what the fuss is about. > Confirm. This entire thread seems like much ado about nothing. -- Tony Arcieri __

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Daniel Micay
On 28/03/14 09:52 PM, Tony Arcieri wrote: > On Thu, Mar 27, 2014 at 1:17 PM, Steve Klabnik > wrote: > > > Why isn't there a compiler flag like 'noboundscheck' which would > disable all bounds checking for vectors? It would make it easier to > have those

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tony Arcieri
On Thu, Mar 27, 2014 at 1:17 PM, Steve Klabnik wrote: > > Why isn't there a compiler flag like 'noboundscheck' which would disable > all bounds checking for vectors? It would make it easier to have those > language performance benchmarks It seems like, prior to even proposing such a feature, you

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Brian Anderson
I can imagine that if you want to actually run *rustc* on these then our build system is insufficient to produce an arm-linux-unknown-gnueabihf rustc compiler from another host. *That* is a problem that needs to be solved for a variety of reasons, but also pretty hard. On 03/28/2014 06:08 PM,

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Chip Collier
I have a beaglebone I could donate. Arch has some cross compilation information for the platform. Haven't had a moment to sit down and try it but I'm very interested in using rust on these devices. On Mar 28, 2014 6:03 PM, "Ian Daniher" wrote: > > Any chance of getting arm-linux-unknown-gnueabihf

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Brian Anderson
I don't actually know what the issue is with Rust on arm-linux-unknown-gnueabihf. Is cross-compiling to this architecture with Rust difficult? Why do we need binaries? One thing we could possibly do without much difficulty is let external build slaves connect to our build master. That plus a s

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Ian Daniher
> Any chance of getting arm-linux-unknown-gnueabihf builds? I came here to ask this same thing - I'm doing work with rust on cheap elinux arm boards. Understand the not mucking with established infrastructure in the midst of everything else - I'm willing to put up hardware with help, but right no

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Brian Anderson
Not in the near term I think, at least as long as it's I that has to do the automation - there are many other automation changes already in the pipeline just for linux/mac/win. I am at this point amenable to opening up our infrastructure to one or two trusted and motivated individuals, since I

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Brian Anderson
On 03/28/2014 05:13 AM, Ben Noordhuis wrote: On Fri, Mar 28, 2014 at 2:25 AM, Brian Anderson wrote: Hi. I have very exciting news. Rust now has binary installers for Linux and Mac, as well as nightly builds for Windows, Linux and Mac. Official Rust installers now come in the following forms:

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Evan G
Whoops, I accidentally sent this to Peter instead of the whole list... This doesn't even need to be a very hard feature to implement, or require any new syntax. All that needs to happen is for the compiler to know that "& 0b11" means the only viable options are 00, 01, 10, and 11. True? val[6..7]

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Zoltán Tóth
Do not close this thread. This is actually the most exciting one currently. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Peter Marheine
Adding the list for Evan's benefit. :) >> On Fri, Mar 28, 2014 at 10:21 AM, Evan G wrote: >> > Sorry, I didn't see your message about an n-bit integer type. It sounds >> > like >> > a great solution! I was just responding to the "warrant a core feature". >> > I'm >> > just saying it doesn't reall

Re: [rust-dev] Refactor json.rs

2014-03-28 Thread Niko Matsakis
Just FYI, I have been working on resolving this issue, but don't have time to write up my intermediate thought process at the moment. Sorry. Hopefully soon. :) Niko On Sat, Mar 22, 2014 at 10:24:51PM +0800, Edward Wang wrote: > Hi, > > I'm in the process of fixing a `ty_trait` variance inferenc

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tommi
On 28 Mar 2014, at 15:43, Matthew Frazier wrote: > I would just like to interject that this conversation has been blowing my > inbox up all morning and seems to be going absolutely nowhere. > That's a good argument against using mailing lists for this kind of a purpose. __

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Peter Marheine
On Fri, Mar 28, 2014 at 9:57 AM, Evan G wrote: > This doesn't even need to be a very hard feature to implement, or require > any new syntax. All that needs to happen is for the compiler to know that "& > 0b11" means the only viable options are 00, 01, 10, and 11. True? This is true, but doesn't m

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tommi
On 28 Mar 2014, at 14:47, Daniel Micay wrote: > On 28/03/14 07:44 AM, Tommi wrote: >> >> This is incorrect. All those range based functions (or majority of >> them... I'm not sure) are safe if the range(s) you pass to them is safe. >> That's why those range functions can't guarantee safety as pa

[rust-dev] Fwd: matching on a few bits in int

2014-03-28 Thread Edward Wang
Whoops, excluded the list. I always fancy some Erlang style binary pattern matching in rust: case X of <<2#00:2, _:6>> -> 1; <<2#01:2, _:6>> -> 2; <<2#10:2, _:6>> -> 3; <<2#11:2, _:6>> -> 4 end. Syntax is a bit alien but we can adapt that to the rust land. -Ed On Fri, Mar 28,

[rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Sanghyeon Seo
Lee Braiden wrote: > I'm sure it's more complicated than that, technically, but if it's MUCH > more technically complicated, then the compiler probably has design issues. To defend rustc's honor: rustc has no such design issues. 1. Open src/librustc/middle/trans/expr.rs in the editor. 2. Search f

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tommi
On 28 Mar 2014, at 17:46, Erick Tryzelaar wrote: > Disagreement is fine [..] I would think that to be an axiom which didn't need to be mentioned. What I think this whole discussion boils down to, is orthodoxy vs. pragmatism. The pragmatic think that wiggle room is always good and that it's goo

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Lee Braiden
On 28/03/14 13:51, Jared Forsyth wrote: It just seems that all arguments have been made 5+ times by both sides. I would agree that mailing list discussions that start going in circles become no longer appropriate for a mailing list. I've yet to see any valid explanation for why the instructi

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Lee Braiden
On 28/03/14 15:31, Sanghyeon Seo wrote: To defend rustc's honor: rustc has no such design issues. That's my favourite part of this whole thread. Really. :D -- Lee ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/ru

[rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Erick Tryzelaar
All, This thread is going in bad places. Everyone please keep in our community guidelines: https://github.com/mozilla/rust/wiki/Note-development-policy#conduct Disagreement is fine but this is getting to be uncivil. We made the design decision to constrain unsafety to small blocks a long time a

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Peter Marheine
On Fri, Mar 28, 2014 at 9:30 AM, Jared Forsyth wrote: > Is rust's macro system powerful enough to do calculations, such that you > would be able to guarantee that the provided patterns were exhaustive? > From what I've seen, the macro system can mostly just do syntax expansion - > not logic, etc.

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Jared Forsyth
On Fri, Mar 28, 2014 at 7:56 AM, Peter Marheine wrote: > This sounds like a good use case for a macro, though > Is rust's macro system powerful enough to do calculations, such that you would be able to guarantee that the provided patterns were exhaustive? >From what I've seen, the macro system c

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Matthew Frazier
I would just like to interject that this conversation has been blowing my inbox up all morning and seems to be going absolutely nowhere. The people on both sides of this issue have stated their arguments exhaustively, and I neither believe that the Rust developers would ever introduce a flag that d

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Jared Forsyth
It just seems that all arguments have been made 5+ times by both sides. I would agree that mailing list discussions that start going in circles become no longer appropriate for a mailing list. On Fri, Mar 28, 2014 at 7:48 AM, Tommi wrote: > On 28 Mar 2014, at 15:43, Matthew Frazier wrote: > >

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Clark Gaebel
I think it's a great little feature that would set rust apart in the embedded development space, and perfectly viable to be a compiler feature. It's not for everyone, but the people that would find it useful would find it REALLY useful. Rust might even find a niche in safety critical software. -

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Peter Marheine
While potentially useful, I don't think this use case is common enough to warrant being a core feature. This sounds like a good use case for a macro, though. Something like: match bitfield!(val, 6..7) { 0b00 => ..., 0b01 => ..., 0b10 => ..., 0b11 => ... } c

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Chris Morgan
Any chance of getting arm-linux-unknown-gnueabihf builds? ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tommi
On 28 Mar 2014, at 15:01, Huon Wilson wrote: > [..] And anyway, as Daniel and Patrick say, if you don't need the utmost > safety, then Rust isn't the language you're looking for: things like C++ work > well in the speed department, at the cost of safety Yes, it seems that Rust isn't the langua

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Vladimir Pouzanov
Sorry, that's definitely a typo, (val >> 6) & 0b11 makes sense, (val & 0b11) >> 6 does not. On Fri, Mar 28, 2014 at 1:04 PM, Clark Gaebel wrote: > I like this! Although I think that match might've been better written > `(val >> 6) & 0b11`, but it'd be really nice for the compiler to catch > tho

Re: [rust-dev] matching on a few bits in int

2014-03-28 Thread Clark Gaebel
I like this! Although I think that match might've been better written `(val >> 6) & 0b11`, but it'd be really nice for the compiler to catch those type of errors! - Clark On Fri, Mar 28, 2014 at 5:54 AM, Vladimir Pouzanov wrote: > There's one thing that I often have to deal in embedded code —

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Michael Thorpe
If your hotspot is spread across thousands and thousands of lines of code, you have made major architectural mistakes. > On 28 Mar 2014, at 12:49, Tommi wrote: > >> On 28 Mar 2014, at 14:27, Daniel Micay wrote: >> >>> On 28/03/14 08:25 AM, Tommi wrote: On 28 Mar 2014, at 05:56, Patrick

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Huon Wilson
On 28/03/14 23:49, Tommi wrote: On 28 Mar 2014, at 14:27, Daniel Micay wrote: On 28/03/14 08:25 AM, Tommi wrote: On 28 Mar 2014, at 05:56, Patrick Walton wrote: I think that Rust should give you the ability to opt out of safety, but on a per-operation basis. Having it as a compiler option

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tommi
On 28 Mar 2014, at 14:27, Daniel Micay wrote: > On 28/03/14 08:25 AM, Tommi wrote: >> On 28 Mar 2014, at 05:56, Patrick Walton wrote: >>> >>> I think that Rust should give you the ability to opt out of safety, but on >>> a per-operation basis. Having it as a compiler option is too much of a >

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Daniel Micay
On 28/03/14 07:44 AM, Tommi wrote: > > This is incorrect. All those range based functions (or majority of > them... I'm not sure) are safe if the range(s) you pass to them is safe. > That's why those range functions can't guarantee safety as part of their > signature. For example, look at the follo

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Clark Gaebel
A good "plus" for rust here is that in general, the idiomatic way to access arrays in a loop doesn't use bounds checking. For example, to write a dot product in c++ you'd do this: double dot(const double* x, const double* y, int len) { double result = 0.0; for(int i = 0; i < len; ++i) resu

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Evan G
We don't WANT that though. Haven't you been reading? If we need that flag to perform as well as C++, we'll have failed in our mission. We don't just want to make a safe language: we want to make one safe, fast, and concurrent. Also, as Daniel pointed out, the stdlib already relies heavily on safety

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Patrick Walton
On 3/28/14 5:25 AM, Tommi wrote: On 28 Mar 2014, at 05:56, Patrick Walton wrote: I think that Rust should give you the ability to opt out of safety, but on a per-operation basis. Having it as a compiler option is too much of a sledgehammer: often you want some non-performance-critical bounds

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Daniel Micay
On 28/03/14 08:25 AM, Tommi wrote: > On 28 Mar 2014, at 05:56, Patrick Walton wrote: >> >> I think that Rust should give you the ability to opt out of safety, but on a >> per-operation basis. Having it as a compiler option is too much of a >> sledgehammer: often you want some non-performance-cri

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Daniel Micay
On 28/03/14 08:13 AM, Ben Noordhuis wrote: > On Fri, Mar 28, 2014 at 2:25 AM, Brian Anderson wrote: >> Hi. >> >> I have very exciting news. Rust now has binary installers for Linux and Mac, >> as well as nightly builds for Windows, Linux and Mac. >> >> Official Rust installers now come in the foll

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tommi
On 28 Mar 2014, at 05:56, Patrick Walton wrote: > > I think that Rust should give you the ability to opt out of safety, but on a > per-operation basis. Having it as a compiler option is too much of a > sledgehammer: often you want some non-performance-critical bounds to be > checked in the nam

Re: [rust-dev] New Rust binary installers and nightlies

2014-03-28 Thread Ben Noordhuis
On Fri, Mar 28, 2014 at 2:25 AM, Brian Anderson wrote: > Hi. > > I have very exciting news. Rust now has binary installers for Linux and Mac, > as well as nightly builds for Windows, Linux and Mac. > > Official Rust installers now come in the following forms: > > * source .tar.gz - the same old so

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Daniel Micay
On 28/03/14 07:04 AM, Lee Braiden wrote: > On 28/03/14 03:48, Daniel Micay wrote: >> On 27/03/14 11:04 PM, Tommi Tissari wrote: >>> Case by case is all fine and good. But you're trying argue what a >>> programmer *should* do if he knew what was good for him. >> Rust doesn't view the programmer as a

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Huon Wilson
On 28/03/14 22:04, Lee Braiden wrote: On 28/03/14 03:48, Daniel Micay wrote: On 27/03/14 11:04 PM, Tommi Tissari wrote: Case by case is all fine and good. But you're trying argue what a programmer *should* do if he knew what was good for him. Rust doesn't view the programmer as an infallible,

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Tommi
On 28 Mar 2014, at 05:48, Daniel Micay wrote: >> I don't know about those other dialects. > > You're proposing introducing new dialect of Rust. > > In Crust, code generating a failure on out-of-bounds will now cause > silent memory corruption. Crust will do away with safety boundaries > complet

Re: [rust-dev] Compiling with no bounds checking for vectors?

2014-03-28 Thread Lee Braiden
On 28/03/14 03:48, Daniel Micay wrote: On 27/03/14 11:04 PM, Tommi Tissari wrote: Case by case is all fine and good. But you're trying argue what a programmer *should* do if he knew what was good for him. Rust doesn't view the programmer as an infallible, trusted entity. Actually, I believe

Re: [rust-dev] Everything private by default

2014-03-28 Thread Daniel Micay
On 28/03/14 06:34 AM, Matthieu Monrocq wrote: > > Because you can already have the functionality by using `unsafe`, so why > should one at *twice* the same functionality in different ways ? > > I believe optimizers should be good enough to remove most bound checks > (especially in loops), and if t

Re: [rust-dev] Everything private by default

2014-03-28 Thread Matthieu Monrocq
On Thu, Mar 27, 2014 at 8:12 PM, Tommi wrote: > [The following post has nothing to do with thread. I'm posting it here > because my new posts to this mailing list don't go through (this happens to > me a lot). Replies to existing posts tend to go through, thus I'm hijacking > my own thread.] > >

[rust-dev] matching on a few bits in int

2014-03-28 Thread Vladimir Pouzanov
There's one thing that I often have to deal in embedded code — doing match on a few bits from an I/O register, which is commonly u32: let val : u32 = ...; match (val & 0b11) >> 6 { 0b00 => ..., 0b01 => ..., 0b10 => ..., _ => {} } You can clearly see two problems here: I need to provide a