Closed flofriday closed 1 year ago
Yes, I guess it's the only way we could do this...
I think so too.
Maybe there is a way we could do it as an operator but it is a generic operator infix && (a: T, b: T) > T
which I am not sure we can implement in the typechecker that easily. But other than that there are no restrictions on T as any object has the isNil
computed member.
Yes, currently we only support generics for builtin classes...
The other problem is, that normally this operator has a different evaluation flow, similar to ||. So only if the left expression was evaluated to nil, we evaluate the right expression.
Actually we will rewrite them in the parser to the the ternary operator and I will implement them now together with the ternary operator.
Implemented
Example
Notes
I think we should implement it as its own AST Node and not as a custom operator.