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

Design question: Fit and purpose of u and r commands in REPL #35

Closed
simonvanderveldt opened this issue Oct 14, 2019 · 8 comments
Closed
Labels

Comments

@simonvanderveldt
Copy link
Member

We have two commands in the REPL that to me feel a bit off, u (upload) and r (run).

According to the help they operate on files and allow one to either run the contents of this file or write them to flash and then run them.

IMHO there are a couple of issues with these commands:

  • First of all: Assuming the sole purpose of these commands is uploading/running files: It operates on files/data outside of the scope of the REPL unlike all the other things that one can do which are all interactive and stay within the REPL. Is this something we want? Does this make sense?
    To me it feels like the command-line (or a GUI program for that matter) offers easy enough means to browse the filesystem and upload/run scripts so I'm not sure there's much benefit of including it in the REPL.

Now if we do want to keep this functionality there are some other issues:

  • If no argument is passed we fall back to a hardcoded sketch.lua as path.
    crowlib.execute(writer, myprint, "./sketch.lua")
    IMHO we should only take filenames/paths and that's it, no magic defaults.
  • Then if more than one argument is given we send it directly to crow
    writer(bytes(cmd + "\r\n", 'utf-8'))
    This seems like a bad idea because it's inconsistent/kinda polymorphic. This also means it's difficult to do any useful validations on the input.

@trentgill @tehn What do you think?

@tehn
Copy link
Member

tehn commented Oct 14, 2019

i appreciate that maiden splits off meta-commands with a semicolon, ie ;restart which acts on the entire system rather than the currently running LVM (a command which is also invalid lua, hence signaling meta-ness). perhaps this is part of the issue you're having, is the name-spacing?

agreed that there's no need for a default sketch.lua --- it's even weirder now that druid can be "run from anywhere" given the pip install. the convenience of up-arrow makes it unnecessary as a shortcut

not sure what you mean by extra args. i wouldn't ever expect there to be more args than a single file path (sorry, i haven't kept up closely with druid--- so many fires)

@simonvanderveldt
Copy link
Member Author

simonvanderveldt commented Oct 14, 2019

i appreciate that maiden splits off meta-commands with a semicolon, ie ;restart which acts on the entire system rather than the currently running LVM (a command which is also invalid lua, hence signaling meta-ness). perhaps this is part of the issue you're having, is the name-spacing?

I think it's more that it doesn't really make sense to me to do stuff like uploading a file from the filesystem in an interactive session/REPL.
Or formulated the other way around: The interactive session is there for interactive/immediate stuff, like setting an output to some value and seeing/hearing that happen immediately. Or monitoring the inputs and seeing their values change immediately.
Writing a whole script doesn't seem to match with that interactive/exploratory purpose.
(might also just be me, that's why I'm asking 🙂)

@tehn
Copy link
Member

tehn commented Oct 14, 2019

the docs explain the setup--- i think it makes sense.

editor side-by-side with druid. during development you'll want to live-query via the REPL for debugging. and upload to get your thing working. i actually have no idea how you're successfully make a script otherwise. you'd need three windows--- one for just a script uploader?

@simonvanderveldt
Copy link
Member Author

simonvanderveldt commented Oct 14, 2019

i actually have no idea how you're successfully make a script otherwise. you'd need three windows--- one for just a script uploader?

Ah, OK, like this you mean? https://monome.org/docs/crow/scripting/#stage-two-executing
That explains it. Also relevant because only one process can open a serial device at a time, meaning one would need to choose between REPL or command-line, which wouldn't work by default.

Personally now that #30 is merged I'd prefer to integrate it into my editor so the normal build commands upload to/run it on crow but that can be done later.

This does mean that we then probably want some way of properly navigating the filesystem within druid.

@tehn
Copy link
Member

tehn commented Oct 14, 2019

by navigating the file system i would be fine with just a quick meta command to print a list of the *.lua files in the current working folder

@simonvanderveldt
Copy link
Member Author

I was thinking something like this?
image

@szvsw
Copy link
Contributor

szvsw commented Oct 14, 2019

agree with @tehn that all that is needed for navigating the file system is a command to print a list of lua files in the current working folder.

I don't think that there should be another method of navigating within druid. It is really easy to quickly q out of druid, cd to a new location, and then druid back into druid. in most cases, you will already enter druid from your folder where you store all of your crow scripts.

it is already a lot for people to learn how to nav the command line using cd; seems unnecessary/overkill to have to learn how to do it in druid as well.

just my 2c.

@simonvanderveldt
Copy link
Member Author

OK, thanks for the feedback/info. I totally missed the usecase of running druid side by side with an editor :)

I'll create a follow-up issue for adding some form of directory browsing and will create a PR to remove the hardcoded "sketch.lua" stuff.

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

No branches or pull requests

3 participants