News for hackers. Stuff that matters.
Re:More Good Programming Quotes (2016) by rrobukef on Saturday July 22, 2017 @04:33AM (#14826041)
Open type variation require existential types. Not the easy types people are used to.
Re:More Good Programming Quotes (2016) by tome on Saturday July 22, 2017 @04:34AM (#14826047)
Could you explain what you mean by "open type variation"? Google's throwing up nothing relevant ...
Re:More Good Programming Quotes (2016) by JadeNB on Saturday July 22, 2017 @12:50PM (#14828034)
I think it refers to open unions, which are types specified with some constructors that might have additional constructors defined later. As you say, Google is curiously reticent, but see, for example, p. 60 of http://www.seas.upenn.edu/~cis500/cis500-f06/ocaml-book.pdf .
Re:More Good Programming Quotes (2016) by rrobukef on Saturday July 22, 2017 @01:23PM (#14828229)
Sorry for the confusion, JadeNB is correct: open type unions. For when you want plugin-like code without significant recompilations.
Re:More Good Programming Quotes (2016) by tome on Saturday July 22, 2017 @04:48PM (#14829295)
OK, fine. Well in Haskell we have Dynamic. Of course matching on a Dynamic may fail, but that's OK because the basis for comparison is untyped languages! Matching on types can always fail there too.
Re:More Good Programming Quotes (2016) by rrobukef on Monday July 24, 2017 @04:46AM (#14836823)
With Dynamic, yes, but not with existential quantification. The type is a proof the type-class is implemented.

I also didn't yet know Dynamic, thanks. I'm not that fluent in fp.

Re:More Good Programming Quotes (2016) by Ace17 on Saturday July 22, 2017 @08:02AM (#14826749)
polymorphism?
Re:More Good Programming Quotes (2016) by tome on Saturday July 22, 2017 @09:27AM (#14827086)
I don't think that can be it. Polymorphism doesn't require existential types!
Re:More Good Programming Quotes (2016) by rrobukef on Saturday July 22, 2017 @01:29PM (#14828253)
Closed polymorhpism can always be pattern-matched but it requires modifying all matchers. Open polymorphism is the default in OO interfaces: you can always implement a new type by adding code locally.

Since existential types can be monomorphised and compiled to binary code allowing type-safe plugins.

Re:More Good Programming Quotes (2016) by Ace17 on Saturday July 22, 2017 @05:21PM (#14829445)
Yeah, I was referring to polymorphism as we have in OO, where old code can call new code. I didn't even know "closed polymorphism" was a thing (is it equivalent to algebraic types?).
Re:More Good Programming Quotes (2016) by rrobukef on Monday July 24, 2017 @05:15AM (#14836942)
I'm not precise anymore with jargon concerning polymorphism (it's all the same to me), which I probably shouldn't do. I consider two factors: first closed/open (or finite/arbitrary) of 'remembering' an erased type, and second the sugar for nested 'remembering'. Almost all languages have both (open and closed) as either built-in, as a library or as a design pattern for that language. It boils down to either a tagged union or a function pointer. And both can be transformed to the other if needed.

Assembly, C have tagged unions & function pointers. Java has visitors, instanceOf, reflection. C++ has visitors, boost::variant, dynamic casts, mach7. Haskell has ADTs, pattern matching, existential quantification, Dynamic. Rust has pattern matching, traits, Any. Python, javascript, lua, lisp are dynamic, it's easy enough to create both.