Skip to content
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

Kernel crash using MAIN() #113

Open
antononcube opened this issue Mar 16, 2024 · 4 comments
Open

Kernel crash using MAIN() #113

antononcube opened this issue Mar 16, 2024 · 4 comments

Comments

@antononcube
Copy link
Contributor

antononcube commented Mar 16, 2024

Executing a Raku cell with this code crashes the Jupyter kernel (in both Visual Studio Code and Safari):

sub MAIN() {
    say 'HERE!!!';
}

I get the message:

Usage:
  jupyter-chatbook.raku

The Kernel crashed while executing code in the current cell or a previous cell. 
Please review the code in the cell(s) to identify a possible cause of the failure. 
Click [here](https://aka.ms/vscodeJupyterKernelCrash) for more info. 
View Jupyter [log](command:jupyter.viewOutput) for further details.
@bduggan
Copy link
Owner

bduggan commented Mar 18, 2024

Interesting. Is there a use case for this? If not, preventing it seems like the most straightforward fix.

@antononcube
Copy link
Contributor Author

antononcube commented Mar 18, 2024

I have both a use case and a non-use case: asking LLMs to generate Raku code (say, for random pet names) gives often code with MAIN definitions. Of course, it is easy to edit the generated code, but the crash is fairly disrupting work-wise (or presentation-wise.)

(I got MAIN codes when I was making the Raku LLaMA guide movie.)

@bduggan
Copy link
Owner

bduggan commented Mar 18, 2024

Oh, I see. So, in this case the desired behavior would be for it to work like any other sub, i.e. not have any interactions with the command-line world

@antononcube
Copy link
Contributor Author

I think that is fine. I would not (or didn't) expect MAIN in Jupyter Kernel to interact "outside" of the notebook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants