Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All KCL types should have human-friendly types #5744

Open
adamchalmers opened this issue Mar 11, 2025 · 0 comments
Open

All KCL types should have human-friendly types #5744

adamchalmers opened this issue Mar 11, 2025 · 0 comments

Comments

@adamchalmers
Copy link
Collaborator

Right now KCL types have names taken from Rust. E.g. SketchOrSurface's type is defined in Rust, and its name is the name of the Rust type.

But we should allow KCL types to present different names to KCL users. For example, when KCL gives a type error it shouldn't say "Expected SketchOrSurface". Rather, the error should say "Expected either a Sketch or a Surface".

Possible implementation

Add a new method to trait FromKclValue, something like fn type_name() -> String. Then use that in error messages. It could have a default implementation which calls to tynm::type_name or something, and then for some types we could override it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant