Skip to content
/ b3 Public

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

Open
milahu wants to merge 4 commits intokamadorueda:mainfrom
milahu:build_math_fn
Open

add macro: build_math_fn, implement math: add sub mul#3
milahu wants to merge 4 commits intokamadorueda:mainfrom
milahu:build_math_fn

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