Re: [rust-dev] include_sized_bin!(type, file)

2014-05-27 Thread Tommi Tissari
I would use it for large, immutable, static lookup tables. I could use 'include_bin' and wrap any use of it in a 'std::mem::transmute', but I'd rather not. Also, I'd appreciate the sanity check for knowing the file size matches the size of the lookup table's type. E.g. static lut: [[MyStruct,

Re: [rust-dev] box ref foo?

2014-05-27 Thread Tommi Tissari
Thanks. I had failed to realize that 'ref radius' would make 'radius' a Boxf32 value. On 27 May 2014, at 20:29, Oleg Eterevsky o...@eterevsky.com wrote: As far as I understand (I'm a newbie too), it means that 'radius' is the reference to the value in the box. On Tue, May 27, 2014 at

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-10 Thread Tommi Tissari
On 10 Apr 2014, at 07:53, Kevin Ballard ke...@sb.org wrote: On Apr 9, 2014, at 9:50 PM, Tommi Tissari rusty.ga...@icloud.com wrote: On 10 Apr 2014, at 00:22, Kevin Ballard ke...@sb.org wrote: FWIW, my point about range is it relies on One being the number 1, rather than being

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-10 Thread Tommi Tissari
. On 10 Apr 2014, at 09:27, Kevin Ballard ke...@sb.org wrote: On Apr 9, 2014, at 11:25 PM, Tommi Tissari rusty.ga...@icloud.com wrote: On 10 Apr 2014, at 07:55, Corey Richardson co...@octayn.net wrote: range doesn't return a forward iterator. RangeA also implements DoubleEndedIterator

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-09 Thread Tommi Tissari
: On Apr 7, 2014, at 1:02 AM, Tommi Tissari rusty.ga...@icloud.com wrote: On 07 Apr 2014, at 08:44, Nicholas Radford nikradf...@googlemail.com wrote: I think the original question was, why does the zero trait require the add trait. If that was the original question, then my answer would

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-09 Thread Tommi Tissari
On 09 Apr 2014, at 20:46, Kevin Ballard ke...@sb.org wrote: For reference, the Zero trait lives in std::num, which should be a good indication that this is a property of numeric types. Am I not supposed to use std::num::Zero for defining things like zero vector or zero matrix? Those are

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-09 Thread Tommi Tissari
On 09 Apr 2014, at 20:46, Kevin Ballard ke...@sb.org wrote: Why? Zero is the additive identity. Zero is _an_ additive identity for numbers, but not for vectors or matrices. use std::slice::Items; use std::iter::RandomAccessIterator; use std::num::Zero; Items is a RandomAccessIterator, but a

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-09 Thread Tommi Tissari
On 10 Apr 2014, at 00:22, Kevin Ballard ke...@sb.org wrote: FWIW, my point about range is it relies on One being the number 1, rather than being the multiplicative identity. AFAIK there's nothing special about 1 in a ring outside of its status as a multiplicative identity. Certainly it's

Re: [rust-dev] Tagged integral floating-point types

2014-04-08 Thread Tommi Tissari
I just realized that this 'Invalid' trait is also a prime example of why traits must be able to specify their items as private. Obviously that 'invalid' static method / constant should not be part of the public interface. Heck, the sole reason for the existence of the type could be that it

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-07 Thread Tommi Tissari
On 07 Apr 2014, at 08:44, Nicholas Radford nikradf...@googlemail.com wrote: I think the original question was, why does the zero trait require the add trait. If that was the original question, then my answer would be that std::num::Zero requires the Add trait because of the way it is

Re: [rust-dev] Tagged integral floating-point types

2014-04-04 Thread Tommi Tissari
On 04 Apr 2014, at 12:30, Vadim Chugunov vadi...@gmail.com wrote: Regarding the original idea: Why use a whole bit, when you only need one value out of all possible type's values? For example, for floats, one of the NaNs could be used for this purpose without any issues with overflow as

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

2014-03-27 Thread Tommi Tissari
Compiling with that flag would figuratively speaking wrap everything inside an unsafe block and then omit vector bounds checking. The flag wouldn't be allowed for library builds. What I find a bit totalitarian about this situation is that the language forces a decision which the programmer

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

2014-03-27 Thread Tommi Tissari
danielmi...@gmail.com wrote: On 27/03/14 09:02 PM, Tommi Tissari wrote: Compiling with that flag would figuratively speaking wrap everything inside an unsafe block and then omit vector bounds checking. The flag wouldn't be allowed for library builds. What I find a bit totalitarian about

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

2014-03-27 Thread Tommi Tissari
is memory safe (although it's opt-in) and it has this noboundscheck flag. So I don't see what the problem is. On 28 Mar 2014, at 03:17, Daniel Micay danielmi...@gmail.com wrote: On 27/03/14 09:02 PM, Tommi Tissari wrote: the language forces a decision which the programmer should

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

2014-03-27 Thread Tommi Tissari
On 28 Mar 2014, at 03:41, Jeffery Olson olson.jeff...@gmail.com wrote: forces a decision which the programmer should be allowed to make for himself. A bit like someone dictating my hair style. Yes. Rust is just like hair salon that forbids you from setting your own hair on fire.

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

2014-03-27 Thread Tommi Tissari
rust have this flag too. On 28 Mar 2014, at 04:26, Daniel Micay danielmi...@gmail.com wrote: On 27/03/14 10:04 PM, Tommi Tissari wrote: Opting in case by case is not the same thing as having a compiler flag which you can toggle without modifying the source. A case-by-case basis

Re: [rust-dev] Built-in types should accept a pointer rhs-argument to binary operators

2013-11-15 Thread Tommi Tissari
On 15 Nov 2013, at 20:58, Niko Matsakis n...@alum.mit.edu wrote: On Thu, Nov 14, 2013 at 09:05:40PM +0200, Tommi wrote: In other words, no autoderef or other transformation takes place. We just look for a matching trait. Instead we just pass the values in by reference. The reason for