3 ms·
This is presumably not what you're thinking of but ofc Javascript uses objects as prototype "types". As is, they wont provide what you want, but if there was so
by kitd 4y ago
This is presumably not what you're thinking of but ofc Javascript uses objects as prototype "types". As is, they wont provide what you want, but if there was some kind of "compile-time" processing of prototypes such that types assemblies, dependencies, constraints and other relationships could be manipulated or asserted before they were applied in runtime code, that may provide some of the "first-class type" functionality mentioned.
Ed: actually, Typescript might be a better host for this.
- eckza 4y agoFP Or Die Gang is downvoting you, but this is actually correct. No referential transparency (among other things, no doubt) makes this a harder problem to solve than just using a language that supports it. $0.02
- still_grokking 4y agoIf you don't have referential transparency mathematical equations don't hold. You can't be sure that `a = b` stays true if deducted once. So "the problem" doesn't get only harder, it becomes impossible to solve in a formal way.
- eckza 4y agoThank you for this. That's exactly what I was getting at; you illustrated it far better.
- still_grokking 4y agoThe down-votes are likely because the example isn't anyhow good. But the idea to have static prototype types is imho quite interesting on its own. I was thinking a lot about that in the past. I would love to have JS like objects—but in a static context. Row polymorphism and extensible records are close but still not there actually.