Re: How to use a non-static objects in string `mixin`?

2022-08-29 Thread Dukc via Digitalmars-d-learn
On Saturday, 27 August 2022 at 13:20:13 UTC, hype_editor wrote: I need to use function `eval` sometimes, but compiler throws an error: `Error: variable `firstOperand` cannot be read at compile time`. You're probably misunderstanding `mixin`. It does not work like an eval function at Lisp or

Re: How to use a non-static objects in string `mixin`?

2022-08-27 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 27 August 2022 at 13:20:13 UTC, hype_editor wrote: I need to use function `eval` sometimes, but compiler throws an error: `Error: variable `firstOperand` cannot be read at compile time`. ```d override public double eval() { double firstOperand = firs

How to use a non-static objects in string `mixin`?

2022-08-27 Thread hype_editor via Digitalmars-d-learn
I need to use function `eval` sometimes, but compiler throws an error: `Error: variable `firstOperand` cannot be read at compile time`. ```d import std.array; import std.format; public class BinaryOperatorExpression { private { string operator; Ex