New REPL features

Hey guys,

I’ve pushed some enhancements to the REPL that I’d like some feedback on.

Git repo:

This update includes:

  • multi-line support
  • ability to enter more complex statements
  • determination and output of variable type (if possible)
  • output of the variable contents (if possible).

See attached screenshot for examples.

It’s not perfect but I think we are headed in a good direction. When you type or paste in a tab character, you will see the help prompts, which needs to be disabled for the REPL. I just haven’t figured out what I need to change to disable this.

Any feedback you guys can provide would be appreciated!



The examples look pretty cool, Grant. The try catch method seems to work for multi-line statements, but I have some questions about it. What if the user simply typos a single-line statement? Won’t the REPL assume it was multiline? Also, how will the user ever see the error message that goes along with their typo?

I’d almost like to go with a parsing approach where we count the number of opening and closing parens and curlies before we just try/catch and assume. Of course, all this applies to the script REPL.

Also, out of curiosity do other REPLs in the programming world output the variable type? It’s interesting, but I found it a bit distracting in the output-- especially since I already know what the data types are. If this is common in other REPLs, then just chalk it up to my inexperience with REPLs in general.

Regarding the tab completion, I actually noticed that too yesterday and made a mental note of it. The completor is a CFC being proxied as a Java class to the console reader object. It’s set in the system/util/ReaderFactory.cfc file.

Check out the API docs for the ConsoleReader class (We use JLine under the hood)

There are method in there for getting the list of completors, removing them, or adding them back in. We should minimally be able to remove the completor and add it back when we’re done kind of like how we handle the history files. Or, if there is actually a use for tab completion, we could write a script and tag REPL completor.

As far as inserting special characters, I allow new lines in parameter values via \n and I think I have a ticket in to support tabs with \t. That’s a bit of a slippery slope to start down though since you have to start parsing all input and then having escape chars for your escape chars… You can see how the command parser works a bit by looking in system/util/Parser.cfc.



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform: