Re: [rust-dev] Encapsulating mutiple generic types

2014-12-01 Thread Tim Kuehn
Can you use a trait for that? trait Database: Store + Logger {} On Mon, Dec 1, 2014 at 11:48 AM, Philippe Daouadi blastro...@free.fr wrote: Hi, In my project, I use something like: struct Database { db: BoxStore + 'static, logger: BoxLogger + 'static, } Does anyone know what

Re: [rust-dev] Why there's this asymmetry in defining a generic type/function/method and calling it?

2014-11-18 Thread Tim Kuehn
On Tue, Nov 18, 2014 at 12:23 PM, Daniel Trstenjak daniel.trsten...@gmail.com wrote: Hi Steven, On Tue, Nov 18, 2014 at 07:41:38PM +, Steven Fackler wrote: The syntax is ambiguous: let foo = (HashMapFoo, Barnew()); You mean 'let foo = (HashMapFoo, Bar::new());' , right? Is

Re: [rust-dev] type annotaion of mut

2014-09-22 Thread Tim Kuehn
That doesn't seem to be what the compilation error says: mut.rs:10:19: 10:20 error: use of moved value: `a` mut.rs:10 println!({},a); ^ note: in expansion of format_args! std macros:2:23: 2:77 note: expansion site std macros:1:1: 3:2 note: in expansion of println!

Re: [rust-dev] reader.lines() swallows io errors

2014-02-19 Thread Tim Kuehn
On Tue, Feb 18, 2014 at 11:52 PM, Phil Dawes rustp...@phildawes.net wrote: Is that not a big problem for production code? I think I'd prefer the default case to be to crash the task than deal with a logic bug. The existence of library functions that swallow errors makes reviewing code and

Re: [rust-dev] Nick Cameron joins the Rust team at Mozilla

2014-02-03 Thread Tim Kuehn
Fantastic! Good luck, Nick! On Mon, Feb 3, 2014 at 6:51 PM, Alex Crichton a...@crichton.co wrote: Welcome Nick! I can't wait to see that 1.0 issue count go down! On Mon, Feb 3, 2014 at 6:20 PM, Brian Anderson bander...@mozilla.com wrote: Hi Rusties, I'm just thrilled to announce

Re: [rust-dev] Proposal: Change Parametric Polymorphism Declaration Syntax

2014-02-01 Thread Tim Kuehn
On Sat, Feb 1, 2014 at 3:06 PM, Benjamin Striegel ben.strie...@gmail.comwrote: Another point in favor of this plan is that it would eliminate the need to put type parameters directly after the `impl`, which to be honest *is* pretty weird and inconsistent with the rest of the language. But I'm

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

2013-12-01 Thread Tim Kuehn
On Sun, Dec 1, 2013 at 8:04 AM, spir denis.s...@gmail.com wrote: On 12/01/2013 02:51 AM, Florian Zeitz wrote: If I may chime in here. I agree with Kevin that the different semantics of `new` are more likely to create confusion, than alleviate it. Personally I would suggest calling this

Re: [rust-dev] Removing some autoref magic

2013-11-20 Thread Tim Kuehn
This strikes me as a good point. I think the incongruity this would create between functions and methods -- along with the additional syntactic burden -- could lead to the use of functions feeling second class in some sense. Also, how would static methods be treated? Cheers, Tim On Wed, Nov 20,

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

2013-11-02 Thread Tim Kuehn
Instead of `do spawn` try `do spawn_with(s) |s| { ... }`. Then the closure won't close over s, but rather take it as an argument, allowing it to move it out. Cheers On Sat, Nov 2, 2013 at 5:05 PM, Leah Hanson astriea...@gmail.com wrote: Thanks, Brendan. :) You’re trying to move the ~strs

Re: [rust-dev] Unified function/method call syntax and further

2013-10-20 Thread Tim Kuehn
simplification MIME-Version: 1.0 Content-Type: multipart/mixed; boundary7823106168118235853== --===7823106168118235853== Content-Type: multipart/alternative; boundary=4SVSQE8L3ECYN7Z8RACUF07S828YYG --4SVSQE8L3ECYN7Z8RACUF07S828YYG Content-Type: text/plain;

Re: [rust-dev] Minimal raytracer

2013-09-24 Thread Tim Kuehn
To make it a fair fight, I converted the Go and C++ versions to trace Rust instead. These are my results on my Macbook Pro: === RUST === $ rustc -O bin.rs $ time ./bin rrays.ppm real 0m14.472s user 0m14.102s sys 0m0.365s === GO === $ go build main.go $ time ./main grays.ppm real 0m13.928s

Re: [rust-dev] Minimal raytracer

2013-09-24 Thread Tim Kuehn
curious if currently we make any distinction at all between opt levels 2 and 3. Also, what version of Rust? I believe our support for LLVM-SIMD-vectorization-pass voodoo only landed recently. On Tue, Sep 24, 2013 at 2:13 PM, Tim Kuehn tku...@cmu.edu wrote: To make it a fair fight, I

Re: [rust-dev] average function

2013-09-24 Thread Tim Kuehn
There's also std::iter::AdditiveIterator. fn averageT: Num + NumCast + Clone(values: [T]) - T { let sum = values.iter().map(|n| n.clone()).sum(); sum / num::cast(values.len()) } On Tue, Sep 24, 2013 at 7:36 PM, Brendan Zabarauskas bjz...@yahoo.com.auwrote: I normally prefer using