Comments (3)
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:
open Module.Name.[fun1; fun2]
open Module.Name.{fun1, fun2}
open Module.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.
from alpaca.
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
, likeadopt
orinherit
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?
from alpaca.
I'd always be a fan of bringing in OCaml's module system whole-sale (and its implicit modules PR too).
from alpaca.
Related Issues (20)
- Function parsing as incorrect arity with ADT as first arg HOT 2
- Auto-imported pipe operator HOT 2
- Treat types with a single unqualified member as aliases HOT 1
- Overlap between function heads and match expression HOT 1
- How to type Erlang terms without built-in types. HOT 7
- alias module name HOT 1
- Zero arity functions HOT 5
- Inconsistent function case HOT 2
- Compile error with type signature annotation
- Defining the function (>>) does not yield a helpful error
- Use values to signify test pass/fail rather than exceptions
- Can't find a way to contact the creator/mantainers of alpaca :) HOT 2
- ReasonML HOT 4
- provide prebuilt "binaries" for OTP 21
- Status? HOT 4
- "Overloaded" records with constructors in patterns fail instead of getting a proper warning.
- Incorrect line numbers for missing record field errors
- clarify - nominal or structural type system HOT 3
- ADT argument in function header crashes compiler
- Non-exhaustive patterns in "match" expressions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alpaca.