raku-jupyter-kernel
raku-jupyter-kernel copied to clipboard
Kernel crash using MAIN()
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.
Interesting. Is there a use case for this? If not, preventing it seems like the most straightforward fix.
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.)
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
I think that is fine. I would not (or didn't) expect MAIN in Jupyter Kernel to interact "outside" of the notebook.