numbat icon indicating copy to clipboard operation
numbat copied to clipboard

Allow .nbt files to be loaded in REPL environment

Open NogginBops opened this issue 1 year ago • 6 comments

It's very handy for testing and development to be able to load functions specified in a file into an interactive session.

This might be possible using modules (?), but the documentation around modules is very lacking and it's very unclear how you would load a file in the REPL environment.

NogginBops avatar Sep 20 '24 13:09 NogginBops

Did you see this part of the documentation? If not, where did you look? What did you search for?

https://numbat.dev/doc/cli-customization.html#custom-functions-constants-units

sharkdp avatar Sep 20 '24 20:09 sharkdp

I don't want to have the file be in some modules folder. I want to be able to load any file anywhere on my computer. Like loading files in prolog repl or similar.

NogginBops avatar Sep 22 '24 15:09 NogginBops

I could see utility in a command that loads the contents of a file not necessarily in a modules folder. It would make it easier to use the cli as a REPL while developing a script, without cluttering the namespace with each new project or having to update configurations or environment variables for each.
When writing F# code, I frequently do something similar by loading scripts into fsi to experiment with the outputs of the functions I wrote. Currently I often do the same in Numbat by copy and pasting definitions manually.

Goju-Ryu avatar Sep 23 '24 11:09 Goju-Ryu

Okay. So basically the counterpart to the save command. Sounds reasonable.

sharkdp avatar Oct 08 '24 21:10 sharkdp

I started working on this feature but was not sure how to call the new command. Maybe load as the opposite of save or just run possibly?

Bzero avatar Oct 14 '24 03:10 Bzero

I started working on this feature but was not sure how to call the new command. Maybe load as the opposite of save or just run possibly?

I like load. Maybe hold off from doing too much work on commands until this discussion is resolved. Also note that there is another commands-PR (#590)

sharkdp avatar Oct 23 '24 18:10 sharkdp