Re: More on Rust language

2014-05-10 Thread Dicebot via Digitalmars-d
On Saturday, 10 May 2014 at 11:43:29 UTC, Xavier Bigand wrote: Le 10/05/2014 11:35, Douglas Peterson a écrit : Rust is quite seductive (own point of view of course) in its "traits" system. They've found the right median line between OOP and TMP. I mean it's a realy nice concept. Have you a d

Re: More on Rust language

2014-05-10 Thread Araq via Digitalmars-d
It increases the complexity to reason about code. No, that's wrong. Why it is wrong? Because it is much harder to reason about the same things without type system support.

Re: More on Rust language

2014-05-10 Thread Xavier Bigand via Digitalmars-d
Le 10/05/2014 11:35, Douglas Peterson a écrit : Rust is quite seductive (own point of view of course) in its "traits" system. They've found the right median line between OOP and TMP. I mean it's a realy nice concept. Have you a direct link about traits? Cause I am almost unable to see their tu

Re: More on Rust language

2014-05-10 Thread Douglas Peterson via Digitalmars-d
Rust is quite seductive (own point of view of course) in its "traits" system. They've found the right median line between OOP and TMP. I mean it's a realy nice concept.

Re: More on Rust language

2014-05-09 Thread Paulo Pinto via Digitalmars-d
Am 09.05.2014 21:53, schrieb Araq: It increases the complexity to reason about code. No, that's wrong. Why it is wrong? Even you ever seen a programmer reason about unique pointers, shared pointers, weak pointers, naked pointers, references and cyclic data structures without mistakes?

Re: More on Rust language

2014-05-09 Thread Araq via Digitalmars-d
It increases the complexity to reason about code. No, that's wrong. If the compiler does not give an helping hand, bugs are too easy to create. Usually a type system is used to increase safety...

Re: More on Rust language

2014-05-09 Thread marwy via Digitalmars-d
On Friday, 4 November 2011 at 03:14:29 UTC, bearophile wrote: Through Reddit I've found two introductions to the system language Rust being developed by Mozilla. This is one of them: http://marijnhaverbeke.nl/rust_tutorial/ This is an alpha-state tutorial, so some parts are unfinished and som

Re: More on Rust language

2014-05-08 Thread Paulo Pinto via Digitalmars-d
On Friday, 9 May 2014 at 04:55:28 UTC, Caligo via Digitalmars-d wrote: On Thu, Nov 3, 2011 at 10:43 PM, Walter Bright wrote: How do you implement a moving GC in D if D has raw pointers? It can be done if the D compiler emits full runtime type info. It's a solved problem with GCs. D s

Re: More on Rust language

2014-05-08 Thread Caligo via Digitalmars-d
On Thu, Nov 3, 2011 at 10:43 PM, Walter Bright wrote: > > How do you implement a moving GC in D if D has >> raw pointers? >> > > It can be done if the D compiler emits full runtime type info. It's a > solved problem with GCs. > > > D semantics doesn't allow the GC to automatically modify those >

Re: More on Rust language

2011-11-03 Thread Walter Bright
On 11/3/2011 9:14 PM, bearophile wrote: Regarding pointer types, in D there are function pointers and function delegates, they are kind of two different kinds of pointers already. And their only saving grace is they are not used that often, so the complexity is tolerable. This is not so for po

Re: More on Rust language

2011-11-03 Thread bearophile
Walter Bright: > You're wrong still :-) In this newsgroup I am used to being wrong several times every day :-) > It can be done if the D compiler emits full runtime type info. It's a solved > problem with GCs. I see, I will have to read more on this solution. > Besides, having two pointer t

Re: More on Rust language

2011-11-03 Thread Walter Bright
On 11/3/2011 8:14 PM, bearophile wrote: Mark-compact (aka moving) collectors, where live objects are moved together to make allocated memory more compact. Note that doing this involves updating pointers’ values on the fly. This category includes semispace collectors as well as the more efficient

Re: More on Rust language

2011-11-03 Thread bearophile
I have found a slides pack, Rust All Hands Winter 2011, with some notes on typestates too: http://www.slideshare.net/pcwalton/rust-all-hands-winter-2011 And here there are some tests about macros too, search the word "macro": https://github.com/graydon/rust/tree/master/src/test/run-pass Bye, bea

More on Rust language

2011-11-03 Thread bearophile
Through Reddit I've found two introductions to the system language Rust being developed by Mozilla. This is one of them: http://marijnhaverbeke.nl/rust_tutorial/ This is an alpha-state tutorial, so some parts are unfinished and some parts will probably change, in the language too. Unfortunatel

Re: More on Rust

2011-02-23 Thread Bruno Medeiros
On 10/02/2011 00:23, bearophile wrote: But in Rust there are typestates, so while a variable can't change type, its type sometimes changes state along the flow of the code, such state of the type may be different in different parts of the code Hum, this typestate concept actually looks quite

Re: More on Rust

2011-02-11 Thread Andrej Mitrovic
On 2/11/11, Christopher Nicholson-Sauls wrote: > > Even better: > > switch( funcall() ) { > case "foo", "bar", "foobar", "barfoo": { > // complex code > break; > } > > case "blue", "green": { > // complex code > break; > } > > default: >

Re: More on Rust

2011-02-11 Thread Christopher Nicholson-Sauls
On 02/10/11 13:49, Andrej Mitrovic wrote: > On 2/10/11, Walter Bright wrote: >> auto x = (localtime().hours >= 8) ? "awake!" : "asleep, go away."; > > Aye, a one liner! > > I hate seeing things like this: > if (funcall()) > { > var = "foo"; > } > else > { > var = "bar"; > } > > So much

Re: More on Rust

2011-02-11 Thread Jim
spir Wrote: > On 02/11/2011 08:39 AM, Jim wrote: > > Jacob Carlborg Wrote: > > > >> On 2011-02-10 20:15, Walter Bright wrote: > >>> Nick Sabalausky wrote: > "bearophile" wrote in message > news:iivb5n$na3$1...@digitalmars.com... > > auto x; > > if (localtime().hours>= 8) { > >>>

Re: More on Rust

2011-02-11 Thread spir
On 02/11/2011 08:39 AM, Jim wrote: Jacob Carlborg Wrote: On 2011-02-10 20:15, Walter Bright wrote: Nick Sabalausky wrote: "bearophile" wrote in message news:iivb5n$na3$1...@digitalmars.com... auto x; if (localtime().hours>= 8) { x = "awake!" } else { x = "asleep, go away." } log "I'm " + x;

Re: More on Rust

2011-02-11 Thread Jean Crystof
Jim Wrote: > Jacob Carlborg Wrote: > > > On 2011-02-10 20:15, Walter Bright wrote: > > > Nick Sabalausky wrote: > > >> "bearophile" wrote in message > > >> news:iivb5n$na3$1...@digitalmars.com... > > >>> auto x; > > >>> if (localtime().hours >= 8) { > > >>> x = "awake!" > > >>> } else { > > >>>

Re: More on Rust

2011-02-11 Thread Jacob Carlborg
On 2011-02-11 08:39, Jim wrote: Jacob Carlborg Wrote: On 2011-02-10 20:15, Walter Bright wrote: Nick Sabalausky wrote: "bearophile" wrote in message news:iivb5n$na3$1...@digitalmars.com... auto x; if (localtime().hours>= 8) { x = "awake!" } else { x = "asleep, go away." } log "I'm " + x;

Re: More on Rust

2011-02-10 Thread Jim
Jacob Carlborg Wrote: > On 2011-02-10 20:15, Walter Bright wrote: > > Nick Sabalausky wrote: > >> "bearophile" wrote in message > >> news:iivb5n$na3$1...@digitalmars.com... > >>> auto x; > >>> if (localtime().hours >= 8) { > >>> x = "awake!" > >>> } else { > >>> x = "asleep, go away." > >>> } > >

Re: More on Rust

2011-02-10 Thread Jacob Carlborg
On 2011-02-10 20:15, Walter Bright wrote: Nick Sabalausky wrote: "bearophile" wrote in message news:iivb5n$na3$1...@digitalmars.com... auto x; if (localtime().hours >= 8) { x = "awake!" } else { x = "asleep, go away." } log "I'm " + x; That would be really nice to have in D. auto x = (lo

Re: More on Rust

2011-02-10 Thread Andrej Mitrovic
On 2/10/11, Walter Bright wrote: > auto x = (localtime().hours >= 8) ? "awake!" : "asleep, go away."; Aye, a one liner! I hate seeing things like this: if (funcall()) { var = "foo"; } else { var = "bar"; } So much clutter instead of using the simple: var = funcall() ? "foo" : "bar"; I

Re: More on Rust

2011-02-10 Thread Walter Bright
Nick Sabalausky wrote: "bearophile" wrote in message news:iivb5n$na3$1...@digitalmars.com... auto x; if (localtime().hours >= 8) { x = "awake!" } else { x = "asleep, go away." } log "I'm " + x; That would be really nice to have in D. auto x = (localtime().hours >= 8) ? "awake!" : "a

Re: More on Rust

2011-02-10 Thread Jesse Phillips
Jean Crystof Wrote: > How about this? > spir Wrote: > > auto x = > if (localtime().hours>= 8) { > "awake!" > } else { > "asleep, go away." > }; > > log "I'm " + x; > > I think it solves the problem of unkown type for x nicely. And it's very > close to what we already have. someth

Re: More on Rust

2011-02-10 Thread Andrej Mitrovic
On 2/10/11, spir wrote: > I'm not a great fan of auto, neither, use it would happily live w/o it, > except > for functions operating on ranges, that return types coming from who-knows > where (certainly another planet). auto is great for rapid prototyping. And so are templated functions. After I'

Re: More on Rust

2011-02-10 Thread Jean Crystof
spir Wrote: > On 02/10/2011 06:43 AM, Nick Sabalausky wrote: > > "bearophile" wrote in message > > news:iivb5n$na3$1...@digitalmars.com... > >> > >> auto x; > >> if (localtime().hours>= 8) { > >> x = "awake!" > >> } else { > >> x = "asleep, go away." > >> } > >> log "I'm " + x; > >> > > >

Re: More on Rust

2011-02-10 Thread spir
On 02/10/2011 06:43 AM, Nick Sabalausky wrote: "bearophile" wrote in message news:iivb5n$na3$1...@digitalmars.com... auto x; if (localtime().hours>= 8) { x = "awake!" } else { x = "asleep, go away." } log "I'm " + x; That would be really nice to have in D. There's been many times I'

Re: More on Rust

2011-02-09 Thread Nick Sabalausky
"bearophile" wrote in message news:iivb5n$na3$1...@digitalmars.com... > > auto x; > if (localtime().hours >= 8) { >x = "awake!" > } else { >x = "asleep, go away." > } > log "I'm " + x; > That would be really nice to have in D. There's been many times I've needed to move a declaration up

Re: More on Rust

2011-02-09 Thread so
both the name and the operator of logging are very bad choices. Oh '+' is string concat in Rust, and log is not that bad either!

Re: More on Rust

2011-02-09 Thread so
Rust is statically typed, so this is an error, it's not possible (unless you use some kind of variant): Not quite clear in the example but just add an extra line after if block. log "do you want to add strings or ints?"; auto use_str = input.readline == "strings"; if (use_str) { a = "hell

More on Rust

2011-02-09 Thread bearophile
The Development of the Rust language from Mozilla and Graydon Hoare is going on. It will probably become a quite interesting system language, quite more interesting than Go. One of the most interesting features of Rust will be its typestate. Rust has structural typing too, this is sometimes use