-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Missing signature with multi sub on REPL #3925
Comments
Thank you for your report! I'm afraid this is a deficiency of the REPL that will be hard to fix. When you execute your example, the third candidate does appear to exist:
If one reverses the order in which the subs are defined, calling the
If you define all of the candidates in a single line, and then call the ackermann function, it works as expected:
The problem is caused by a deficiency in how the REPL handles multiple lines of code: each line is its own compilation unit, and some tricks are being done to pass on the results of earlier lines. But this is known to have some issues that some people run into, like you did. In this case, I think the problem is that even though the last
while "clearly" there is such a candidate after the third candidate got defined. I'm afraid this will be pretty hard to fix generally, so I'm going to close this issue as a "won't fix". Please re-open if you disagree. |
@lizmat I thought "torture developers" was the motto all the time, no? The REPL indeed has issues, and that's the reason for its re-design/re-write when anyone is brave and skilled enough to do that. |
Basically, any line that does *not* create any direct output to STDOUT, becomes part of the code that will be executed whenever the next line is input. This is a behaviour similar to what is done when a line is deemed incomplete. The only difference is, is that this new behaviour will not be visible because of a prompt change. This fixes a number of issues with information being lost between lines, makes a TODO pass in t/02-rakudo/repl.t and is basically a fix for issues #2284 and #3925. Matias Linares++ Altai-man++ for keeping me tortured :-) Please be aware that this potentially opens a whole new nest of REPL bugs. We'll cross that bridge when we get there.
Fixed with 7c0a81f501 :-) |
Basically, any line that does *not* create any direct output to STDOUT, becomes part of the code that will be executed whenever the next line is input. This is a behaviour similar to what is done when a line is deemed incomplete. The only difference is, is that this new behaviour will not be visible because of a prompt change. This fixes a number of issues with information being lost between lines, makes a TODO pass in t/02-rakudo/repl.t and is basically a fix for issues rakudo#2284 and rakudo#3925. Matias Linares++ Altai-man++ for keeping me tortured :-) Please be aware that this potentially opens a whole new nest of REPL bugs. We'll cross that bridge when we get there.
The Problem
Given the following snippet:
The last definition of
ackermann
seems to not being defined. On the repl the output of the last line is:BUT saving that snippet on a file and running it gives no error:
Expected Behavior
Print
125
in the REPLActual Behavior
Cannot resolve caller ackermann(Int:D, Int:D)
error.Steps to Reproduce
Environment
perl6 -v
orraku -v
):The text was updated successfully, but these errors were encountered: