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

KCL: Cannot pass stdlib functions as values #4751

Open
adamchalmers opened this issue Dec 11, 2024 · 0 comments
Open

KCL: Cannot pass stdlib functions as values #4751

adamchalmers opened this issue Dec 11, 2024 · 0 comments
Labels
kcl Language and compiler features

Comments

@adamchalmers
Copy link
Collaborator

adamchalmers commented Dec 11, 2024

Here's a simple KCL program.

f = sin

This should work, you should be able to assign stdlib functions to variables. But it doesn't, it fails with an error about sin not being found.

This is because sin and other stdlib functions aren't kept in ProgramMemory, they're looked up in a separate namespace.

You should be able to use stdlib functions as normal KCL values, and pass them around in memory, use them as arguments to functions, etc.

An interesting consequence of this bug is that the MemoryFunction type, for storing Rust functions (i.e. KCL stdlib) in KCL memory, is never actually used.

@adamchalmers adamchalmers added the kcl Language and compiler features label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kcl Language and compiler features
Projects
None yet
Development

No branches or pull requests

1 participant