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
The GetoptsState struct is declared in the yash-env crate while it is only used in the getopts built-in which is implemented in the yash-builtin crate. For better cohesion, the state should be declared in the yash-builtin crate.
To allow saving the state in the environment from the built-in, Env will need to contain something like HashSet<Box<dyn Any>> that differentiates entries by their type ids. With such a set, any users of Env can add arbitrary data that have the same lifetime as Env and that can only be accessed from contexts that know the data's type.
We might want to wait for dyn upcasting coercion to stabilize so that we can have Box<dyn AnyDebug> instead of Box<dyn Any> where trait AnyDebug: Any + Debug {}. The data in Env have to be cloneable, so we will need a custom trait anyway.
The text was updated successfully, but these errors were encountered:
The
GetoptsState
struct is declared in theyash-env
crate while it is only used in thegetopts
built-in which is implemented in theyash-builtin
crate. For better cohesion, the state should be declared in theyash-builtin
crate.To allow saving the state in the environment from the built-in,
Env
will need to contain something likeHashSet<Box<dyn Any>>
that differentiates entries by their type ids. With such a set, any users ofEnv
can add arbitrary data that have the same lifetime asEnv
and that can only be accessed from contexts that know the data's type.We might want to wait for dyn upcasting coercion to stabilize so that we can haveThe data inBox<dyn AnyDebug>
instead ofBox<dyn Any>
wheretrait AnyDebug: Any + Debug {}
.Env
have to be cloneable, so we will need a custom trait anyway.The text was updated successfully, but these errors were encountered: