Description
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 The data in Box<dyn AnyDebug>
instead of Box<dyn Any>
where trait AnyDebug: Any + Debug {}
.Env
have to be cloneable, so we will need a custom trait anyway.
Metadata
Metadata
Assignees
Projects
Status