-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
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
initialising interdependent variables inside the defsketch macro #33
Comments
I've noticed that if i print the assignment of
this will happen twice. Which i assume is the explanation for this behaviour i'm seeing. |
For anyone else who ends up here. Perhaps this is an example of the way setup should be used: https://github.com/vydd/qelt/blob/master/qelt.lisp#L275 (I will try this, and report back) |
@inconvergent Weird. Thanks for reporting this. I'll try to find some time to look at it during the weekend. |
@vydd no problem. I had a look at the expanded code from the macro. I'm not too sure about how classes/methods work, but i noticed that i could make the following change to get the behaviour i need (expanded with pg's mac-macro):
A naive fix that addresses this could look something like this: inconvergent@8ceda09 Best, A |
Yes this is still the problem til this day, I think the mentioned commit would resolve the problem, if not at least it's at the right direction. |
Also, may i suggest a much more elegant fix, in |
Interestingly, I had a patch that's similar to inconvergent's but using the car of binding. See https://gist.github.com/death/73f001b54d23c7ba83f03c9ade7159ae |
No yh it seems with
when we defsketch with (cell-size pos-vec running) these slots, and But still, I think using |
the double evaluation seems to be fixed when using new |
Hi
I have a problem when it comes to creating objects with their own state when using the
defsketch
macro.Here is simple (and quite pointless) example:
So I'm wondering if this is expected behaviour? (I sort of assume it is.) And what is the preferred way of initialising multiple interdependent things inside
defsketch
, where those things have an internal state?As a sidenote, evaluating the following code has the behaviour i'm expecting
Setup
I see that there is a
setup
method in sketch, but i haven't found any documentation or examples anywhere. Perhaps this is the correct approach? If so, could someone provide an example, please?Thank you for this library either way, it is precisely what i need!
Best
Anders
The text was updated successfully, but these errors were encountered: