Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think what you describe is called "extensible records". Elm had them in a prior version. You can implement them in a language with an expressive enough type system (e.g. Haskell or Scala) without special support, but the syntax can be a bit unwieldy.

Here's three recent papers on extensible records:

* https://arxiv.org/pdf/2108.06296 * https://arxiv.org/pdf/2404.00338 * https://dl.acm.org/doi/pdf/10.1145/3571224

I'm not claiming these are definitive in any sense, but they are useful guides into the literature if any reader wants to learn more. (If you are not used to reading programming language papers, the introduction, related work, and conclusions are usually the most useful. All the greek in the middle can usually be skipped unless you are trying to implement it.)



> I think what you describe is called "extensible records".

From what I read, gp only asks for a way to express the type, not a way to change/extend the type of something during runtime.

Elm's current implementation does this just fine.




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

Search: