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
Currently, it is inconvenient to declare a set of declarations with a set of shared and configurable behaviors.
Consider, for example, a set of declarations that all need to have access to a shared value or type parameter.
Today, one needs to use abstract factories where everything is propagated explicitly. Below is a simple example of an abstract factory that consists of just a single implementation:
In this hypothetical "factory" declaration, all members and type parameters of the outer factory would be accessible in Foo and Bar.
I am not aware of any issues that discuss this. This is not meant to be a complete proposal, I just wanted to point out that I think that this is an issue.
It looks like the module system in OCaml has been designed to deal with this issue. I think that something similar would fit Dart very well and could be very useful to people who want to write modular and maintainable code.
The text was updated successfully, but these errors were encountered:
Currently, it is inconvenient to declare a set of declarations with a set of shared and configurable behaviors.
Consider, for example, a set of declarations that all need to have access to a shared value or type parameter.
Today, one needs to use abstract factories where everything is propagated explicitly. Below is a simple example of an abstract factory that consists of just a single implementation:
Notice how Foo and Bar share
T
,eq
andconstant
. There's a lot of boilerplate code needed to actually make them share them.One way to significantly simplify this could be via a declaration that can contain other declarations. Something like the following:
In this hypothetical "factory" declaration, all members and type parameters of the outer factory would be accessible in Foo and Bar.
I am not aware of any issues that discuss this. This is not meant to be a complete proposal, I just wanted to point out that I think that this is an issue.
It looks like the module system in OCaml has been designed to deal with this issue. I think that something similar would fit Dart very well and could be very useful to people who want to write modular and maintainable code.
The text was updated successfully, but these errors were encountered: