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] Tagged integral floating-point types

2014-04-06 Thread Tommi
On 2014-04-04, at 12:30, Vadim Chugunov vadi...@gmail.com wrote: trait Invalid { fn invalid() - Self; } The compiler could then perform option space optimization for any type implementing 'Invalid'. I just realized that Rust already uses static methods just like the one you suggested

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

2014-04-04 Thread Tommi
Okay. But first I'd like to get some input on for what types T should the language guarantee this suggested optimization for OptionT. Because the optimization could be done for any type T from which at least one or more of these new primitive data types is accessible. But it's not clear whether

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

2014-04-04 Thread Vadim Chugunov
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 would happen in your proposal. Regarding which types?: Perhaps this

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

[rust-dev] Tagged integral floating-point types

2014-04-03 Thread Tommi
I have a suggestion. Let's add new primitive data types: i7, i15, i31, i63, u7, u15, u31, u63, f31 and f63 Those would behave exactly like the integral data and floating-point data types: i8, i16, i32, i64, u8, u16, u32, u64, f32 and f64 ...except that the new data types would come with the

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

2014-04-03 Thread Tommi
I forgot to mention that this same space-optimization could be done for Optionbool already. On 2014-04-04, at 03:18, Tommi rusty.ga...@icloud.com wrote: I have a suggestion. Let's add new primitive data types: i7, i15, i31, i63, u7, u15, u31, u63, f31 and f63 Those would behave exactly

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

2014-04-03 Thread Corey Richardson
Language suggestions should go through our new RFC process: https://github.com/rust-lang/rfcs/blob/master/active/0001-rfc-process.md On Thu, Apr 3, 2014 at 8:26 PM, Tommi rusty.ga...@icloud.com wrote: I forgot to mention that this same space-optimization could be done for Optionbool already.