alantech / alan

Autoscalable Programming Language
https://alan-lang.org
MIT License
306 stars 10 forks source link

Implement 'cond' for basic conditionals #814

Closed dfellis closed 3 months ago

dfellis commented 3 months ago

This only has the bound cond function that executes either the true or the false branch working.

The wrapper function that accepts only a true branch and returns a Maybe{T} doesn't work yet because there's a bug in the Scope implementation that I have finally figured out is much larger than I anticipated. I need to potentially rework how Scope works to a large degree in order to get Rust to accept it. (Creating a child scope actually creates two scopes, one that is registered in the scope tree and the one that is returned; mutating the returned one doesn't affect the one in the tree and so adding arguments to the scope as callable functions does not work.)

That will be a different PR because it would be confusing, otherwise.