3 ms·
Or one could use the lisp-way – and just call the functions <record-name>-<field-name>. This avoids those problems.
by kuschku 12y ago
Or one could use the lisp-way – and just call the functions <record-name>-<field-name>.
This avoids those problems.
- gmfawcett 12y agoThe Ocaml way would be to define the functions in separate modules (A.foo, B.foo, etc.). There are convenient syntaxes for declaring which modules are in scope in a given expression, as well as support for first-class modules (you can define functions that take modules as parameters). The module system is sophisticated, and is arguably the "power feature" of Ocaml.
- creichert 12y agoThis is what you generally see in larger haskell programs which might have a name clash (at least it's what I use): data F = F { fName :: String } data P = P { pName :: String }
- LeonidasXIV 12y agoYes, this is one of the cases where ML modules are elegant, since you can put the definition of the type into its own module, so it becomes F.t and P.t and you avoid field name clashes.