We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I had something like this:
class EquationSolver: substitution_history: Substitution* substitution_history_len: int def substitute(self, sub: Substitution) -> None: self->substitution_history[self.substitution_history_len++] = sub
Note that last line should have self-> in two places, but the second one is self. instead. The error message I got was:
self->
self.
compiler error in file "part2.jou", line 140: cannot increment a field of self
This is a bad error message, because fields of self can be incremented, you just need to do it using the -> operator instead of the . operator.
->
.
The text was updated successfully, but these errors were encountered:
Interesting use of -> for attributes.
Sorry, something went wrong.
Jou's -> is just like in C: foo->bar is equivalent to (*foo).bar, so you use it when foo is a pointer to an instance of a class.
foo->bar
(*foo).bar
foo
I should document classes :)
I just interpreted it as accessing a class instances attribute.
No branches or pull requests
I had something like this:
Note that last line should have
self->
in two places, but the second one isself.
instead. The error message I got was:This is a bad error message, because fields of self can be incremented, you just need to do it using the
->
operator instead of the.
operator.The text was updated successfully, but these errors were encountered: