b3 icon indicating copy to clipboard operation
b3 copied to clipboard

add macro: build_math_fn, implement math: add sub mul

Open milahu opened this issue 2 years ago • 0 comments

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?

milahu avatar May 28 '22 13:05 milahu