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
As a user it is pretty annoying that you need to wrap types for many common cases in Chalk. However, it is also really nice that the types act as documentation for what is expected at each call site.
Proposal: Follow the npt library for numpy by introducing wrapper types: ColorLike, P2Like, V2Like, NameLike, RotationLike? that represent types that can be coerced to the right type. Each with a function to_color(x: ColorLike) -> Color that is called on entrance to these functions. Another benefit of this is that we can throw better run time errors for users who don't run mypy.
Downside: This is a bit slow obviously. We could also try to do this with decorations or something fancy. However I think being explicit is better here.
The text was updated successfully, but these errors were encountered:
Make a pass at:
#97
As a user it is pretty annoying that you need to wrap types for many common cases in Chalk. However, it is also really nice that the types act as documentation for what is expected at each call site.
Proposal: Follow the npt library for numpy by introducing wrapper types: ColorLike, P2Like, V2Like, NameLike, RotationLike? that represent types that can be coerced to the right type. Each with a function
to_color(x: ColorLike) -> Color
that is called on entrance to these functions. Another benefit of this is that we can throw better run time errors for users who don't run mypy.Downside: This is a bit slow obviously. We could also try to do this with decorations or something fancy. However I think being explicit is better here.
The text was updated successfully, but these errors were encountered: