... | ... | @@ -87,7 +87,10 @@ Syntax directed name resolution doesn't use dots at all, the dot remains functio |
|
|
### Comparisons
|
|
|
|
|
|
|
|
|
The benefit of abstracting over field names in Overloading is being able to write code that works against any Record with a given field. So I can have a function:
|
|
|
The DORF proposal is a variant of SORF with similar goals. However, it only solves the narrow name-spacing issue within a module. If a record is imported into another module, it will still clash.
|
|
|
|
|
|
|
|
|
DORF and SORF abstract over fields. The benefit of abstracting over field names is being able to write code that works against any Record with a given field. So I can have a function:
|
|
|
|
|
|
```wiki
|
|
|
getA = r.a
|
... | ... | @@ -105,7 +108,10 @@ The advantage of Namespacing is that the implementation is clear, straightforwar |
|
|
- the extra constraints complicated the type checker and did not play well with higher kinded type variables (at least in the code I had then, I do not claim that this is nessecarily so).
|
|
|
|
|
|
|
|
|
Overloading without abstraction over fields may be able to avoid some of these potential downsides, and a judicious (no virtual fields, etc) implementation of either could look very similar to the programmer.
|
|
|
SORF without abstraction over fields may be able to avoid some of these potential downsides, and a judicious (no virtual fields, etc) implementation of either could look very similar to the programmer.
|
|
|
|
|
|
|
|
|
SORF has also been recognized as an approach to internal type resolution, whereas namespacing would require an internal SORF-like step or some other approach to avoid the need for lots of annotations.
|
|
|
|
|
|
### Type directed name resolution
|
|
|
|
... | ... | @@ -145,7 +151,7 @@ Ur/Web has a [ very advanced records system](http://www.impredicative.com/ur/tut |
|
|
Other FP languages where I looked for a record implementation but it appeared they have no solution for records with the same fields (my information could be wrong/out-dated) ocaml, oz. However, the O in OCaml is for objects, and objects have structural typing that supports abstraction over fields.
|
|
|
|
|
|
|
|
|
I couldn't find great specific information on record implementation ML variants. Best I can tell, SML does not allow records in the same module with the same field. Records from other modules require name-spacing or must be opened up similar to Agda.
|
|
|
I couldn't find great specific information on record implementation ML variants other than SML\#. Best I can tell, SML does not allow records in the same module with the same field. Records from other modules require name-spacing or must be opened up similar to Agda.
|
|
|
|
|
|
### Problems with using the current module namespace mechanism
|
|
|
|
... | ... | |