-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Allow defining callable types in different cells as the struct definition #2038
Comments
Hello. This behavior is intended to encourage adding the call method and the struct definition inside the same cell (see #288). |
@Pangoraw Thanks for the answer! Though throwing an error on a perfectly valid julia code it's a rather heavy-handed encouragement ;) So my use-case is as follows:
I tried to read the issue, but I didn't see the rationale for treating call method any differently from other functions, except for Is there a documented list of what is a valid in julia code but is not valid in Pluto? |
Pluto schedules cells to run based on their dependencies so without this workaround the callable method will behave like any cell using the struct. That means that for cells using the struct only the cell order (whether the cell is higher in the notebook order) will determine the run order which Pluto tries very hard to avoid. For example if you disable this behavior and let the callable method be defined in any cell: What Pluto needs is a way to schedule these cells with a higher priority than other cells using the
There is this wiki page but its not very exhaustive. |
Thanks for the extensive explanation! |
I have a problem that even when I wrap in a begin
struct thingy
end
function (t::thingy)
something(t::thingy) # call another dispatching on thing
end
end it won't work consistently unless the definition of |
Sorry, but there will be no video for this one, It's literally too simple ;)
Happens with
[c3e4b0f8] Pluto v0.19.0
Consider the following code:
I created a type, instantiated it, added a call method to it, called the instance on an argument.
When trying the same in Pluto I get
when defining call method. Here's a Pluto notebook showing the issue.
The text was updated successfully, but these errors were encountered: