Hacker News new | past | comments | ask | show | jobs | submit login

Indeed. While records are my favorite feature from F#, they could be improved.

I'd love it if record definitions were extensible (even abstractly--sometimes you want a record with just the data, and sometimes including db-centric "id, createdTime, etc"), and there should be a way of defining / converting between them without a ton of boilerplate. That would allow something like:

record DbStuff = { id: int; created: DateTime }

record UserRecord: DbStuff { name: string; ... }

var userRecord = new UserRecord(...)

var userData = userRecord.WithoutDbStuff() // but what would be the reflected name of this type?

var newRecord = userData.WithDbStuff(3, DateTime.Now)


Sometimes you want to be able to define records

PhotoData{source, metadata, yada, etc, url} and

PhotoDisp{source, metadata, yada, etc, bytes}

without the repetition, and again with an easy way to convert between the two. (And yes you could simplify the above by using containership but oftentimes there are cross-cutting things that containership doesn't solve. You really want a flattening solution.)

Easy integration with C# anonymous classes should be considered too.

C# has always been the more real-world-centric language so I'd hope these common use cases would be considered.

I second this! The ability to easily create intersection types would be awesome!

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact