Exotic Programming Ideas: Module Systems
stephendiehl.com
Exotic Programming Ideas: Module Systems
1–10 of 57 posts
Re: Exotic Programming Ideas: Module Systems
#2I really like research language 1ML's approach to modules[0]. This allows monomorphic types to be treated like values, avoiding all of OCaml's module syntax (which can be a bit complex and verbose).
Re: Exotic Programming Ideas: Module Systems
#3Re: Exotic Programming Ideas: Module Systems
#4Great read. It's too bad modules are pretty much an afterthought in most langs. I really like research language 1ML's approach to modules[0]. This allows monomorphic types to be treated like values, avoiding all of OCaml's module syntax (which can be a bit complex and verbose). https://people.mpi-sws.org/~rossberg/1ml/1ml-extended.pdf
Re: Exotic Programming Ideas: Module Systems
#5Actually Mesa.
Re: Exotic Programming Ideas: Module Systems
#6Other than the syntax, I’m not sure I understand how this is different from any other object-oriented class definition. I suppose the ability to project the module into the local or top-level scope, but that seems more like syntactic sugar than anything meaningful. What am I missing here?
Re: Exotic Programming Ideas: Module Systems
#7Other than the syntax, I’m not sure I understand how this is different from any other object-oriented class definition. I suppose the ability to project the module into the local or top-level scope, but that seems more like syntactic sugar than anything meaningful. What am I missing here?
C has (unparametrized) modules, calling them “compilation unit”.
Re: Exotic Programming Ideas: Module Systems
#8Great read. It's too bad modules are pretty much an afterthought in most langs. I really like research language 1ML's approach to modules[0]. This allows monomorphic types to be treated like values, avoiding all of OCaml's module syntax (which can be a bit complex and verbose). https://people.mpi-sws.org/~rossberg/1ml/1ml-extended.pdf
Is there a 'readable' code sample of how that would work?
https://github.com/rossberg/1ml
There isn't special module syntax. Modules are more-or-less just structs, and the structs can contain types.
Re: Exotic Programming Ideas: Module Systems
#9Other than the syntax, I’m not sure I understand how this is different from any other object-oriented class definition. I suppose the ability to project the module into the local or top-level scope, but that seems more like syntactic sugar than anything meaningful. What am I missing here?
Modules are structurally typed, so the more typical sub-typing behavior expected from mainstream OOP languages is not applicable to them.
Re: Exotic Programming Ideas: Module Systems
#10Other than the syntax, I’m not sure I understand how this is different from any other object-oriented class definition. I suppose the ability to project the module into the local or top-level scope, but that seems more like syntactic sugar than anything meaningful. What am I missing here?
So you can write a signature like:
module type VectorSpace = sig
module Field : Field
type t
val zero : t
val (+) : t * t -> t
val (*) : Field.t * t -> t
end
In OOP it becomes hard to write an interface like this simple example, and more complex examples become harder still.