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
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
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
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
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
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
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
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.