Details
Description
in C#, this is legal:
int i = new int();
whereas in Boo,
i as int = int()
ERROR: The type 'System.Int32' does not have a visible constructor that matches the argument list '()'.
the blank constructor should create a new instance, even though it is impossible to define a blank constructor in a ValueType, it would be handy for instances like this:
Length(Feet: 5.0)
which would create a new Length, then assign Feet to 5.0, without having to go through an intermediary constructor.
Issue Links
- duplicates
-
BOO-443
Parameterless initialization of structs
-
That's because there is no constructor. Disassemble Int32 and look for yourself.
That's syntax sugar.
int i = new int(); is the same as int i = 0;
jsut do length.Feet = 5.0 directly.