Re: [rust-dev] Qt5 Rust bindings and general C++ to Rust bindings feedback

2014-06-12 Thread Noam Yorav-Raphael
Cool. I was afraid that it will be harder for the compiler to optimize away the enum, but it seems to be doing fine. (If it does turn out that it's harder for the compiler, I don't see a real problem with the approach I suggested, as a runtime failure can only be caused by a bug in the code

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
On 2014-06-11, at 16:27, SiegeLord slab...@aim.com wrote: So, I think the situation is pretty bad. What can be done to fix it? I agree that this seems like a serious regression from C++. If it won't be fixed, I think I'll rather stick with C++. Better the devil you know...

Re: [rust-dev] Is there a Parsec equivalent in Rust?

2014-06-12 Thread Meredith L. Patterson
I have been meaning to write Rust bindings for Hammer ( https://github.com/UpstandingHackers/hammer), my C parser-combinator library which is loosely inspired by Parsec and gratuitously rips off Scala's packrat parser implementation. There is an issue open for it (

Re: [rust-dev] Is there a Parsec equivalent in Rust?

2014-06-12 Thread Ian Daniher
Might be worth checking out https://github.com/kevinmehall/rust-peg. On Wed, Jun 11, 2014 at 2:43 AM, Akira Hayakawa hayak...@valinux.co.jp wrote: Hi, Haskell's Parsec is really a good tool to parse languages. Scala also has the equivalent. What about Rust? -- Akira Hayakawa

Re: [rust-dev] Is there a Parsec equivalent in Rust?

2014-06-12 Thread Rick Richardson
I am by no means a SWIG expert. But would it be possible to work around the missing discriminated union functionality by supplying a typemap and using that to generate a set of Enums? That would would likely result in a more Rust-ish interface as well. On Thu, Jun 12, 2014 at 8:50 AM, Ian

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Patrick Walton
On 6/12/14 1:02 AM, Tommi wrote: On 2014-06-11, at 16:27, SiegeLord slab...@aim.com mailto:slab...@aim.com wrote: So, I think the situation is pretty bad. What can be done to fix it? I agree that this seems like a serious regression from C++. If it won't be fixed, I think I'll rather stick

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Patrick Walton
On 6/11/14 6:27 AM, SiegeLord wrote: So, I think the situation is pretty bad. What can be done to fix it? Seems to me we can just make the overloaded operator traits take by-value self. Patrick ___ Rust-dev mailing list Rust-dev@mozilla.org

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
On 2014-06-12, at 19:08, Patrick Walton pcwal...@mozilla.com wrote: On 6/11/14 6:27 AM, SiegeLord wrote: So, I think the situation is pretty bad. What can be done to fix it? Seems to me we can just make the overloaded operator traits take by-value self. I definitely wouldn't want to see

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Patrick Walton
You could just clone the value to get around that error. On June 12, 2014 10:03:40 AM PDT, Tommi rusty.ga...@icloud.com wrote: On 2014-06-12, at 19:08, Patrick Walton pcwal...@mozilla.com wrote: On 6/11/14 6:27 AM, SiegeLord wrote: So, I think the situation is pretty bad. What can be done to

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Corey Richardson
Or bound by Copy. On Thu, Jun 12, 2014 at 10:17 AM, Patrick Walton pwal...@mozilla.com wrote: You could just clone the value to get around that error. On June 12, 2014 10:03:40 AM PDT, Tommi rusty.ga...@icloud.com wrote: On 2014-06-12, at 19:08, Patrick Walton pcwal...@mozilla.com wrote:

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
I think a new keyword, something like `stable`, is needed for specifying that an argument passed to a trait function is guaranteed to be logically unchanged after the function call. For example: trait Foo { fn foo(stable self); } impl Foo for int { fn foo(self) {} // OK } impl Foo for

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Corey Richardson
It's called Copy. `trait Foo: Copy { ... }`. On Thu, Jun 12, 2014 at 10:26 AM, Tommi rusty.ga...@icloud.com wrote: I think a new keyword, something like `stable`, is needed for specifying that an argument passed to a trait function is guaranteed to be logically unchanged after the function

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
`Copy` types aren't really relevant to a discussion about adding to Rust the C++ like optimization of moving rvalues (of non-Copy types) when they're passed to certain functions. On 2014-06-12, at 20:30, Corey Richardson co...@octayn.net wrote: It's called Copy. `trait Foo: Copy { ... }`.

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Patrick Walton
On 6/12/14 10:46 AM, Tommi wrote: `Copy` types aren't really relevant to a discussion about adding to Rust the C++ like optimization of moving rvalues (of non-Copy types) when they're passed to certain functions. There's nothing to add to Rust. Rust supports moves. Patrick

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Corey Richardson
Implicit cloning is a non-starter. Clones can be very expensive. Hiding that cost is undesirable and would require adding Clone to the language (it's currently a normal library feature). On Thu, Jun 12, 2014 at 10:46 AM, Tommi rusty.ga...@icloud.com wrote: `Copy` types aren't really relevant to

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
On 2014-06-12, at 20:51, Patrick Walton pcwal...@mozilla.com wrote: On 6/12/14 10:46 AM, Tommi wrote: `Copy` types aren't really relevant to a discussion about adding to Rust the C++ like optimization of moving rvalues (of non-Copy types) when they're passed to certain functions. There's

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Dmitry Romanov
Sorry, Im a little new to Rust, but I'm,as many, now considering moving from c++ to Rust and the topic is really important for my tasks. Could you give an Rust example for the concern listed above? Thank you! On Jun 12, 2014 9:51 PM, Patrick Walton pcwal...@mozilla.com wrote: On 6/12/14 10:46

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
On 2014-06-12, at 20:59, Corey Richardson co...@octayn.net wrote: Implicit cloning is a non-starter. Clones can be very expensive. Hiding that cost is undesirable and would require adding Clone to the language (it's currently a normal library feature). But I think it will be easy to make the

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Patrick Walton
On 6/12/14 11:15 AM, Tommi wrote: On 2014-06-12, at 20:59, Corey Richardson co...@octayn.net mailto:co...@octayn.net wrote: Implicit cloning is a non-starter. Clones can be very expensive. Hiding that cost is undesirable and would require adding Clone to the language (it's currently a normal

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
On 2014-06-12, at 21:15, Patrick Walton pcwal...@mozilla.com wrote: On 6/12/14 11:15 AM, Tommi wrote: On 2014-06-12, at 20:59, Corey Richardson co...@octayn.net mailto:co...@octayn.net wrote: Implicit cloning is a non-starter. Clones can be very expensive. Hiding that cost is undesirable

Re: [rust-dev] self/mut self in traits considered harmful(?)

2014-06-12 Thread Tommi
For some reason I got really side-tracked here. The whole point of that `stable` keyword I proposed was not syntax sugar, but that it allows the implementor of such a trait to pass by reference when the operator shouldn't move the passed in argument(s). Like, when you multiply two matrices and

Re: [rust-dev] Building rustc @ 1GB RAM?

2014-06-12 Thread Luqman Aden
On Wed, Jun 11, 2014 at 1:26 PM, Ian Daniher explodingm...@gmail.com wrote: Output of make check for those of you who are interested. failures: [run-pass] run-pass/intrinsic-alignment.rs [run-pass] run-pass/rec-align-u64.rs These are failing because it seems like we just overlooked

Re: [rust-dev] Is there a Parsec equivalent in Rust?

2014-06-12 Thread Corey Richardson
We have a ragel backend. https://github.com/erickt/ragel On Thu, Jun 12, 2014 at 3:28 PM, richo ri...@psych0tik.net wrote: On 11/06/14 15:43 +0900, Akira Hayakawa wrote: Hi, Haskell's Parsec is really a good tool to parse languages. Scala also has the equivalent. What about Rust?

Re: [rust-dev] Is there a Parsec equivalent in Rust?

2014-06-12 Thread richo
On 12/06/14 15:31 -0700, Corey Richardson wrote: We have a ragel backend. https://github.com/erickt/ragel Ask and ye shall receive. Amazing! \o/ ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Is there a Parsec equivalent in Rust?

2014-06-12 Thread Steve Klabnik
It's not possible to directly write a Parsec port because we don't have HKT and therefore monads. Ragel is probably the best bet for now. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev