Records should be able to marked with the Struct Attribute

Oct 9, 2014 at 8:05 PM
This is coming from a work-in-progress PR from here:

The idea is simple: record types can be marked with the Struct attribute therefore making the record be a value type.

I've gotten a lot of feedback from developers really wanting this feature.

I've started a branch working on this, not sure if I should make this into a pull-request because it is not finished.

I still have some big issues:
  • You can construct the record using the default ctor, ex: vec3 ().
  • Incorrect call generation on using the struct record as a argument of type: object; meaning, it does not box and/or constrain the value type.
  • Pickler code may not be favorable (needs review)
Oct 10, 2014 at 4:35 PM
Could you add this to and cross-link here? I'm in favour of this feature but we should get it recorded on so people can discuss it there and for long term visibility. Strangely it doesn't seem to have been recorded there already.

There is a related proposal here - I'm also in favour of that one. Ideally both would be dealt with in the same F# langauge version.

I agree you shouldn't be able to call the default constructor.
Oct 10, 2014 at 7:41 PM