Skip to content

add macro: build_math_fn, implement math: add sub mul #3

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

milahu
Copy link

@milahu milahu commented May 28, 2022

low hanging fruit ...

move build_math_fn to separate file?

lets rename built-in + to built-in add? (etc)
- is used for subtraction and negation
! cannot be used in filenames

rename built_in to builtin? (like in nix)

        match (&*lhs, &*rhs) {
            (Value::String { parts: lhs_value }, Value::String { parts: rhs_value }) => {
                let mut new_value = LinkedList::<StringPart>::new();
                for val in lhs_value {
                    new_value.push_back(*val);
                    // error[E0507]: cannot move out of `*val` which is behind a shared reference
                    // move occurs because `*val` has type `StringPart`, which does not implement the `Copy` trait
                }
                for val in rhs_value {
                    new_value.push_back(*val);
                }
                Ok(Rc::new(Value::String { parts: new_value }))
            }
error[E0507]: cannot move out of `*val` which is behind a shared reference
   --> src/interpreter/runtime.rs:273:41
    |
273 |                     new_value.push_back(*val);
    |                                         ^^^^ move occurs because `*val` has type `StringPart`, which does not implement the `Copy` trait

implement copy trait in nixel?

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

Successfully merging this pull request may close these issues.

1 participant