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 was a suggestion on the #220 language proposal, which I think deserves a proposal on its own.
Sometimes it can be quite handy to expose everything from a module, especially when the module defines a DSL like Html or Elm's elm-css package. However, exposing everything at top-level is, IMHO, rarely a good idea as you're now cluttering your namespace with all values from a given package, and potentially opening yourself to compile errors on package updates and the like.
I've long thought it would be nice to locally being able to expose everything. Locally meaning within a single function scope. I've had trouble coming up with a good syntax for it, though.
@joakin made aware that a feature like this exists in OCaml, and I think the syntax is quite alright.
This proposal suggest being able to locally expose everything in a module like this:
view : Html a
view =
Html.( -- within these parens, every value in the Html module is available
div []
[ span [] [ text "Hello" ]
, span [] [ text " you!" ]
]
)
If the #219 proposal is to be implemented, it could also make it easier to locally decide how which functions an operator refers to:
This was a suggestion on the #220 language proposal, which I think deserves a proposal on its own.
Sometimes it can be quite handy to expose everything from a module, especially when the module defines a DSL like
Html
or Elm'selm-css
package. However, exposing everything at top-level is, IMHO, rarely a good idea as you're now cluttering your namespace with all values from a given package, and potentially opening yourself to compile errors on package updates and the like.I've long thought it would be nice to locally being able to expose everything. Locally meaning within a single function scope. I've had trouble coming up with a good syntax for it, though.
@joakin made aware that a feature like this exists in OCaml, and I think the syntax is quite alright.
This proposal suggest being able to locally expose everything in a module like this:
If the #219 proposal is to be implemented, it could also make it easier to locally decide how which functions an operator refers to:
The text was updated successfully, but these errors were encountered: