Re: [rust-dev] Specifying lifetimes in return types of overloaded operators

2014-04-16 Thread Brendan Zabarauskas
For one, the Index trait is in dire need of an overhaul. In respect to the operator traits in general, I have actually been thinking of submitting an RFC proposing that they take thier parameters by-value instead of by-ref. That would remove the auto-ref behaviour of the operators which is more

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

2014-03-29 Thread Brendan Zabarauskas
On 29 Mar 2014, at 2:12 pm, Tony Arcieri basc...@gmail.com wrote: 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

Re: [rust-dev] Announcing the new Rust package manager, Cargo

2014-03-17 Thread Brendan Zabarauskas
This is incredible news. Thank you for agreeing to help us out in our time of need! I have a couple of questions: - For those of us who are less familiar with Bundler, could you offer a quick run-down of how it works? - Are there any things you learned from doing Bundler that you would do

Re: [rust-dev] history of rust?

2014-02-28 Thread Brendan Zabarauskas
Would be interesting to see the repository history rendered in gource: https://code.google.com/p/gource/ (obviously with all the ugly bloom effects turned off). I had it running for a little yesterday, but I needed to do some tweaking of how the file names were shown - things were getting very

Re: [rust-dev] RFC: Importing/exporting macros

2014-02-25 Thread Brendan Zabarauskas
Agreed. Exporting macros feels like a hack. Importing macros feels like a hack. Global namespaces are a pain. Macros on the whole feel like a second class citizen of the language. I’m not talking about writing them - I’m perfectly fine about that kind of ugliness – I’m referring to the client

Re: [rust-dev] RFC: About the library stabilization process

2014-02-21 Thread Brendan Zabarauskas
We should probably start using the #[deprecated] attribute more. Using it to phase things out in the std is currently annoying because we have the #[deny(deprecated)] attribute on. ~Brendan On 19 Feb 2014, at 12:40 pm, Brian Anderson bander...@mozilla.com wrote: Hey there. I'd like to

[rust-dev] RFC: New Rust channel proposal

2014-01-14 Thread Brendan Zabarauskas
On 15 Jan 2014, at 9:35 am, Eric Reed ecr...@cs.washington.edu wrote: I'm skeptical about combining Chan and SharedChan. Maintaining that distinction is useful for expressing the programmer's intent and would certainly make any analysis that cared to distinguish between single and multiple

Re: [rust-dev] Appeal for CORRECT, capable, future-proof math, pre-1.0

2014-01-12 Thread Brendan Zabarauskas
On 13 Jan 2014, at 12:34 am, Owen Shepherd owen.sheph...@e43.eu wrote: But I also feel that by making the unchecked ones the shorter name, the language would be implicitly sending a message that they're preferred. Custom operator time! Say hello to our checked operators: trait

Re: [rust-dev] general onlookers questions on rust development

2014-01-10 Thread Brendan Zabarauskas
On 11 Jan 2014, at 9:38 am, Don Question donquest...@rocketmail.com wrote: 2. I'm used to curly braces, but every time i have to code in C or JavaScript i miss the better readability of python's curly-free syntax. What was the reason to keep the (imho: annoying) curly braces? I must

Re: [rust-dev] What type to put for index when impl-ing Index?

2014-01-08 Thread Brendan Zabarauskas
struct Foo([f64, ..3]); implI: Int IndexI, f64 for Foo { fn index(self, index: I) - f64 { let index = index.to_uint().unwrap(); match self { Foo(ref v) = v[index].clone() } } } fn main() { let tmp : uint = 0; let foo = Foo([1.0, 2.0, 3.0]);

Re: [rust-dev] Joe Armstrong's universal server

2013-12-19 Thread Brendan Zabarauskas
On 19 Dec 2013, at 10:03 pm, Felix S. Klock II pnkfe...@mozilla.com wrote: rust-dev- From reading the article, I thought the point was that a universal server could be deployed and initiated before the actual service it would offer had actually been *written*. Ah, that makes more sense

Re: [rust-dev] Joe Armstrong's universal server

2013-12-18 Thread Brendan Zabarauskas
On 19 Dec 2013, at 1:26 am, Benjamin Striegel ben.strie...@gmail.com wrote: Hello rusties, I was reading a blog post by Joe Armstrong recently in which he shows off his favorite tiny Erlang program, called the Universal Server:

Re: [rust-dev] Joe Armstrong's universal server

2013-12-18 Thread Brendan Zabarauskas
On 19 Dec 2013, at 5:17 am, Kevin Ballard ke...@sb.org wrote: That's cute, but I don't really understand the point. The sample program he gave: test() - Pid = spawn(fun universal_server/0), Pid ! {become, fun factorial_server/0}, Pid ! {self(), 50}, receive X -

Re: [rust-dev] IRC moderation due to attacks

2013-12-15 Thread Brendan Zabarauskas
On 15 Dec 2013, at 1:39 am, Jack Moffitt j...@metajack.im wrote: Some botnet is picking on #rust. Until the situation is resolved[1] or the botnet gives up, we've been turning on moderation in the #rust IRC room. This means that you won't be able to join #rust or talk in the channel

Re: [rust-dev] Let’s avoid having both foo() and foo_opt()

2013-12-06 Thread Brendan Zabarauskas
On 7 Dec 2013, at 10:47 am, Simon Sapin simon.sa...@exyr.org wrote: This is why we have methods like .map() and .and_then() I like using these higher order functions, but I run into lots of issues with moved values because we don’t have once functions. I end up having to use matches, which

Re: [rust-dev] Higher-Kinded Types vs C++ Combos

2013-12-06 Thread Brendan Zabarauskas
, but that will probably be post 1.0. (I might be getting a little off-topic here) ~Brendan On 7 Dec 2013, at 5:27 pm, Brendan Zabarauskas bjz...@yahoo.com.au wrote: I’m not sure I understand everything in your post, but this is how I’d write you first C++ example: struct NumbersIV, FV

Re: [rust-dev] Interesting talk about (scala) language/compiler complexity

2013-12-04 Thread Brendan Zabarauskas
On 5 Dec 2013, at 1:46 pm, Patrick Walton pcwal...@mozilla.com wrote: The particular criticisms of the Scala compiler, that the front-end does too much desugaring and that code is a string, are definitely not true for the Rust compiler. (Well, OK, `for` is desugared too early, but that has

Re: [rust-dev] Placement new and the loss of `new` to keywords

2013-11-30 Thread Brendan Zabarauskas
On 30 Nov 2013, at 6:55 pm, spir denis.s...@gmail.com wrote: Since this issue is all about placing something into memory, why not use 'mem' ? Denis Some folks have suggested using `alloc`. ___ Rust-dev mailing list Rust-dev@mozilla.org

Re: [rust-dev] do

2013-11-30 Thread Brendan Zabarauskas
On 30 Nov 2013, at 5:34 pm, Oren Ben-Kiki o...@ben-kiki.org wrote: I find `do` syntax form is vital for DSL-ish code. Getting rid of it makes a lot of code look downright ugly. I'd rather it used a more Ruby-ish notation though, I find that putting the `do` far away from the `{ ... }`

Re: [rust-dev] do

2013-11-30 Thread Brendan Zabarauskas
On 1 Dec 2013, at 1:45 pm, Patrick Walton pcwal...@mozilla.com wrote: the experiment of using blocks in place of RAII for stuff like with_c_str or unkillable has failed: it leads to too much rightward drift. Patrick I guess I can agree with that. I remember when I first started with Rust

Re: [rust-dev] Type system thoughts

2013-11-15 Thread Brendan Zabarauskas
Personally I'd appreciate a type system that's able to express SI units, which C++ and Haskell are powerful enough to do[1]. I agree. This is of huge importance when it comes to providing compile time safety guarantees. And if the language is powerful enough to express SI units, then it also

Re: [rust-dev] typing in rust

2013-11-13 Thread Brendan Zabarauskas
SML also shares these semantics when it comes to bindings. That is, a subsequent binding to the same identifier can ‘mask’ those that proceed it, even if they are in the same scope and the bound values are of different types. Once a value has had its identifier masked, it can no longer be

Re: [rust-dev] About owned pointer

2013-11-11 Thread Brendan Zabarauskas
On 12 Nov 2013, at 10:21 am, Gaetan gae...@xeberon.net wrote: - as a typicial rust programmer, will i see the usage of str or ~str as logic or will i have to copy paste some sample code each time because it works this way in rust” This is what I thought at first, but once you use it for a

Re: [rust-dev] Please simplify the syntax for Great Justice

2013-11-11 Thread Brendan Zabarauskas
On 12 Nov 2013, at 10:12 am, John Clements cleme...@brinckerhoff.org wrote: If you had the energy to build an alternate front-end using a parenthesized syntax, I'm sure there are others that would give it a try. Me, for instance! It would be nice if we could: - A: desugar Rust into a small

Re: [rust-dev] How would you map one vector to a vector of a different element type?

2013-11-02 Thread Brendan Zabarauskas
You’re trying to move the ~strs out of the vector. You’ll need to use `move_iter`: ~~~ let ports = do myvect.move_iter().map |s| { let (pport, cchan) = stream(); do spawn { cchan.send(fun(s)) } pport }.to_owned_vec(); ~~~ Also note the use of `to_owned_vec`. `map` lazily

Re: [rust-dev] num::cast

2013-10-29 Thread Brendan Zabarauskas
capable optimizing the code,I wouldn't want an option struct to be created each time I call this function. What would be the way to verify that llvm did the job correctly? Cheers Remi On Oct 28, 2013 11:12 PM, Brendan Zabarauskas bjz...@yahoo.com.au wrote: Yes, it's a static cast, so

Re: [rust-dev] return type of closure

2013-10-29 Thread Brendan Zabarauskas
struct ntimesT(times: uint, value: T) - T; Does this syntax work at the moment? ~Brendan On 29/10/2013, at 9:33 PM, Niko Matsakis n...@alum.mit.edu wrote: Incidentally, my preferred way to return a closure is to use an impl like so: struct ntimesT(times: uint, value: T) - T;

Re: [rust-dev] num::cast

2013-10-28 Thread Brendan Zabarauskas
Yes, it's a static cast, so llvm should optimise that out. Do note however that the API has changed in 0.9-pre, and num::cast now returns an OptionT. So your code would be: ~~~ let res: T = aVariable / num::cast(2).unwrap(); ~~~ LLVM should resolve the conditional at statically - I haven't

Re: [rust-dev] How to use the std::path?

2013-10-26 Thread Brendan Zabarauskas
Using master is highly recommended. Treat the 0.* releases as snapshots as opposed to stable releases. ~Brendan On 26/10/2013, at 11:59 PM, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: On Sat, Oct 26, 2013 at 5:00 PM, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: Hi, This is

Re: [rust-dev] mutable vs. functional APIs

2013-10-21 Thread Brendan Zabarauskas
chain-oriented APIs (methods like `fn frob(self) - Frob`) What about: ~~~ fn frob(self) - Frob { let mut x = self;// not sure if you need `cast::transmute_mut` here x.thing = foo(); x } ~~~ That would solve the 'copying' problem. I was actually considering doing this as a way

[rust-dev] OpenGL: gl-rs updated with command line generation options

2013-09-27 Thread Brendan Zabarauskas
options at the `extern mod` line in your source code. If you have any issues, questions or suggestions, you can contact me on irc.mozilla.org #rust-gamedev[2]. My handle is 'bjz'. Hopefully this helps to give Rust an extra boost in the realm of high-performance graphics! Regards, Brendan

Re: [rust-dev] average function

2013-09-24 Thread Brendan Zabarauskas
I normally prefer using `std::num::{cast, zero}` as its a tad more readable. So: use std::num; fn averageT:Int(values: [T]) - T { values.iter() .fold(num::zero::T(), |x, y| x.add(y)) .div(num::cast(values.len())) } fn main() {

Re: [rust-dev] Struct members in trait definitions

2013-09-20 Thread Brendan Zabarauskas
Adding struct members in traits would be… weird. Where would those members be stored when passing things around by value? This sounds like something for properties. But as Nikko says it is not a planned feature at the moment – there is enough on the table for 1.0 as it is. I'm sure they would

Re: [rust-dev] Rust's newest full-time Engineer

2013-09-16 Thread Brendan Zabarauskas
Congratulations! You've already made some significant contributions to Rust, and we greatly appreciate your efforts. Could think of nobody better to be working on Rust full time. ~Brendan On 17/09/2013, at 6:43 AM, Alex Crichton acrich...@mozilla.com wrote: Greetings rust-dev! I wanted to

[rust-dev] Formatting complex trait definitions and impls

2013-09-03 Thread Brendan Zabarauskas
Has anybody worked out a decent way to lay out complex definitions? This is what I'm starting to do: pub trait AffineSpace S: Field, V: VectorSpaceS : Eq + Zero + AddV, Self + SubSelf, V + ScalarMulS { // ... } impls are harder

Re: [rust-dev] Mozilla using Go

2013-09-01 Thread Brendan Zabarauskas
My understanding is that Rust is meant more for real-time, performance/security critical applications, such as user-facing guis and rendering engines. This also fits nicely with games and graphics applications. There is also the real possibility of it being useful in embedded systems. Go is

Re: [rust-dev] Doc comment conventions + straw poll

2013-08-26 Thread Brendan Zabarauskas
I definitely find this very lovely. Lining up with the tab stops perfectly is a big plus. ~Brendan On 26/08/2013, at 11:21 PM, Armin Ronacher armin.ronac...@active-4.com wrote: Hi, On 26/08/2013 02:59, Corey Richardson wrote: C: The nice thing about this solution is that with the

Re: [rust-dev] parameterizing types and functions by integers

2013-08-23 Thread Brendan Zabarauskas
This would be amazing. At the moment the [T,..n] types are pretty damn useless when it comes to generics. Mathematics, science and units of measure libs would find constant parametrisation most useful. I could imagine something like: fn dotT: Ring, N: uint(a: [T, ..N], b: [T, ..N]) - T { … }

Re: [rust-dev] Order of appearance in files of extern mod, mod and use

2013-08-05 Thread Brendan Zabarauskas
That was my understanding. Without knowing much about the compiler, `mod` seems to declare an item. It would be weird to allow imports between item declarations. ~Brendan On 06/08/2013, at 5:53 AM, Gareth Smith garethdanielsm...@gmail.com wrote: On 05/08/13 19:56, Dov Reshef wrote: If I

Re: [rust-dev] Java versus .NET style for acronyms in type names

2013-08-02 Thread Brendan Zabarauskas
On 03/08/2013, at 12:25 PM, Jeaye je...@arrownext.com wrote: To be fair, and I like being fair, both of these are inconsistent within Rust. If functions_are_like_this then types Should_Be_Like_This or Maybe_like_this. Having different significantly different styles for types, functions

Re: [rust-dev] Function definition syntax

2013-07-30 Thread Brendan Zabarauskas
On 31/07/2013, at 7:29 AM, Graydon Hoare gray...@mozilla.com wrote: we used to use [T,U,V] like Scala, but user feedback decisively rejected it. My kingdom for a few extra bracket characters! Maybe I should be more dictatorial and less democratic when it comes to such things; I'm a bit of

Re: [rust-dev] Function definition syntax

2013-07-29 Thread Brendan Zabarauskas
This would make function signatures harder to read in some instances, particularly when using closures and higher-order functions: let f: fn(T): T = …; fn hofT(x: T, f: fn(T): T): fn(T): T { … } Compare to the current syntax: let f: fn(T) - T = …; fn hofT(x: T, f: fn(T) - T)

Re: [rust-dev] read_byte and sentinel values

2013-07-24 Thread Brendan Zabarauskas
On 25/07/2013, at 2:15 AM, Evan Martin mart...@danga.com wrote: Is an Optionu8 implemented as a pair of (type, value) or is it packed into a single word? A quick test shows: rusti std::sys::size_of::Optionu8() 16 ~Brendan___ Rust-dev

Re: [rust-dev] OpenCL-style accessors, casts.

2013-07-17 Thread Brendan Zabarauskas
Just so folks have the heads up, here is the discussion of the blog post on reddit: http://www.reddit.com/r/rust/comments/1igvye/vision_for_rust_simd/ ~Brendan On 16/07/2013, at 2:27 PM, Jens Nockert j...@nockert.se wrote: Hello rust-dev! I implemented OpenCL-style[0] accessors for SIMD

Re: [rust-dev] OpenCL-style accessors, casts.

2013-07-16 Thread Brendan Zabarauskas
Introducing a new t, ty_simd_vec(t, uint), instead of using the current #[simd] struct { … }, is yet another thing that is controversial about the patch This is indeed a shame because named fields are very nice for clean, self-documenting apis. Perhaps properties solve this, but I don't

Re: [rust-dev] OpenCL-style accessors, casts.

2013-07-16 Thread Brendan Zabarauskas
, at 12:13, Brendan Zabarauskas bjz...@yahoo.com.au wrote: Introducing a new t, ty_simd_vec(t, uint), instead of using the current #[simd] struct { … }, is yet another thing that is controversial about the patch This is indeed a shame because named fields are very nice for clean, self

Re: [rust-dev] bikeshedding println() and friends

2013-07-15 Thread Brendan Zabarauskas
wrote: On Sun, Jul 14, 2013 at 03:51:25PM +1000, Brendan Zabarauskas wrote: I'm a fan of sticking with the fmt! style - it separates the data from the representation as opposed to mixing the two. But maybe I'm just an old fuddy-duddy. +1 for format strings, though I'm not wedded to the precise

Re: [rust-dev] Renamed print/println

2013-07-15 Thread Brendan Zabarauskas
print!()/println!() and printf!()/printfln!() sounds good to me. Adding an extra 'f' isn't much of a hassle for fmt! functionality. ~Brendan On 16/07/2013, at 7:25 AM, Steven Ashley ste...@ashley.net.nz wrote: A possible use case for printfln may be to ensure that a new line is always

Re: [rust-dev] Renamed print/println

2013-07-15 Thread Brendan Zabarauskas
PM, Brendan Zabarauskas bjz...@yahoo.com.au wrote: print!()/println!() and printf!()/printfln!() sounds good to me. Adding an extra 'f' isn't much of a hassle for fmt! functionality. Way I see it is if I can type less than `println(fmt!(%?, foo));`, I'm happy :) That is basically the only

Re: [rust-dev] bikeshedding println() and friends

2013-07-14 Thread Brendan Zabarauskas
Actually, your suggestion would actually be quite nice for quit print debugging. often I doe want to just do: `println(x)`. What about: - print!, println! - comma separated list of values, converted to a string - printf!, printfln! - wraps fmt! Simples. ~Brendan On 14/07/2013, at 12:39 PM,

Re: [rust-dev] bikeshedding println() and friends

2013-07-14 Thread Brendan Zabarauskas
.. no new languages have used it in ages http://golang.org/pkg/fmt/ On 14/07/2013, at 4:29 PM, Bennie Kloosteman bkloo...@gmail.com wrote: The C printf way is very primative .. no new languages have used it in ages and even C++ tried to replace it with cout and overloading . I

Re: [rust-dev] bikeshedding println() and friends

2013-07-13 Thread Brendan Zabarauskas
Not to mention all the allocation that goes on in num::strconv :/ Some work on that could possibly result in a speed up. I'm a fan of sticking with the fmt! style - it separates the data from the representation as opposed to mixing the two. But maybe I'm just an old fuddy-duddy. ~Brendan On