You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is for a discussion and collection of ideas at least related to modules and signatures.
In issue #87 the distinction between OCaml's open and include came up and how the former exposes the imported module's functions in the module doing the opening. Copied from that issue:
My basic opinion right now: I see value in default implementations of signatures/interfaces but would like to consider more specificity than open appears to provide. Thoughts? Links to papers most definitely appreciated :D
The text was updated successfully, but these errors were encountered:
My basic opinion right now: I see value in default implementations of signatures/interfaces but would like to consider more specificity than open appears to provide. Thoughts? Links to papers most definitely appreciated :D
There was talk in the OCaml area somewhat recently about the same but they'd not settled on a syntax, however it would be very nice to have. The suggestions that I remember were something like:
openModule.Name.[fun1; fun2]
openModule.Name.{fun1, fun2}
openModule.Name.(fun1, fun2)
open (fun1, fun2) from Module.Name(* This one was shut down fast due to parser concerns at the time *)open fun1, fun2 from Module.Name(* This one was shut down fast due to parser concerns at the time *)(* And a few others that I do not recall off hand, similar with import too *)
The main boon of include was being able to override prior defined functions in your own file though, adding in let rec with let being nonrec by default would allow for that.
Something like open module.[fun1, fun2/arity] is quite consistent with the existing function import syntax for sure and I do see the advantage in being able to pull in default implementations. I'm not sure about things "opened" overriding the definitions in the module though - that seems sort of backwards to me but I might be thinking about this wrong.
A couple of things off the top of my head:
minor but maybe a different word than open, like adopt or inherit to clearly show that we're making these functions part of the module pulling them in?
not completely thought through yet but this feels like we're going to need an actual module type and system here and probably signatures/interfaces. Any particular thoughts on this? Favourite papers or implementations?
This issue is for a discussion and collection of ideas at least related to modules and signatures.
In issue #87 the distinction between OCaml's
open
andinclude
came up and how the former exposes the imported module's functions in the module doing the opening. Copied from that issue:The text was updated successfully, but these errors were encountered: