Hacker News new | ask | show | jobs
by galangalalgol 1038 days ago
Julia compiles JIT to machine code, and I guess JS/TS and ruby too? All of those benefit from a repl for prototyping.

I think the biggest fail with most repls is the transition from the repl when you have that moment of "it worked" to having the working bits minus the stuff around it crammed into an idiomatic reusable thing. It is fairly easy in matlab, but I haven't found a workflow in Julia that does that well, tried dr. Doc strings, pluto, and vscode plugin. I'd welcome a rust repl too.

3 comments

Developing the module functions with Revise.jl inside vscode and do REPL like things inside jupyterlab makes a pretty good workflow for me. And everytime I try some cpp REPL I end up using more Julia instead.
What matlab workflow do you use that makes transitioning from REPL to file easy?
Its nothing earth shaking. I just type edit foo.m, select the lines from the history that worked and copy them to the new file, perhaps doing a quick namechange or two. It isn't anything a plugin could provide, and doctor doc strings tries to, but it is pretty clumsy, the name change refactoring thing isn't there, and more importantly, the idiomatic way to create a reusable module in julia is a lot heavier. I also run into issues of collisions between the new module and the lines I copied. I'm sure it is all resolvable, it just feels clunky out of the box after using it lightly for a year or so. I can use numpy the same way as matlab mostly, its just really slow. I haven't found a prototyping language other than matlab that I don't find myself thinking "might as well write it in rust as long as this is taking", as I know I'll end up doing that anyway.
> the name change refactoring thing isn't there

what does Matlab provide wrt this? Does its editor have refactoring assistance now?

> the idiomatic way to create a reusable module in julia is a lot heavier

do you mean package creation?

> I also run into issues of collisions between the new module and the lines I copied.

what kind of collisions do you mean?

what would your ideal tool for this look like? you select parts of your REPL history, ask for some name changes in it, give it a package name, and have it generate a package? any other features or steps that come to mind as potentially helpful?

Matlab has some simple refactoring for names changes. Change a name and press shift+enter to change all other occurrences in the file.

Yes, package creation. The "right way" use create package.jl or whatever feels like a speedbump and requires setup.

When I import the newly created model, I have gotten name collisions with the playground remnants which you can't fully clear without restarting the repl.

That sounds like something I'd use, yeah. If you wanted to be fancy, you could make a function, putting uninitialized values into the argument list.