New REPL features

78 views
Skip to first unread message

Robert Virding

unread,
Mar 15, 2015, 10:07:16 PM3/15/15
to lisp-flavo...@googlegroups.com
I am working on the REPL, this apart from ideas in an earlier discussion on LFE initialisation, and have a few ideas. First off is that it has to be fixed in its handling of errors. Second is handling of prompts; now it just prompts on the first input line. What would people think of it prompting every line in the same way the erlang shell does?

Robert

Mason Staugler

unread,
Mar 16, 2015, 1:31:04 PM3/16/15
to lisp-flavo...@googlegroups.com
I would like that.

Duncan McGreggor

unread,
Mar 16, 2015, 3:19:04 PM3/16/15
to lisp-flavo...@googlegroups.com
This is great, Robert!

Here are the thoughts I have on this topic:

1) It would be nice if there was support for two prompts: a primary one (what we have now) and a secondary one for continuation lines. This would help with indentation aesthetics when pasting code (and auto-intending continuation lines)

2) Prompts should be configurable via the new lfe.config file:
    - use numbered prompt (bool)
    - override the default primary prompt
    - override the default secondary prompt
    - optional color for each type of prompt

3) Better error handling in the REPL -- excited about that! I run into that on occasion, and have always just worked around it (and learned to interpret what is really happening)

4) Handling (ignoring) doctrings in the REPL. Right now, when you try to paste a function which has docstrings into the REPL, you get an error. I've been having to maintain a buffer for REPL work, and when it's ready, I have to juggle docstring edits in the module where it lives. It would be nice if I could just paste a function with a docstring into the REPL and not have to work around an error.

5) Thoughts on REPL prompt numbering:
    * I use the REPL for two primary purposes: prototyping/debugging and education
    * For my own work, I never miss the numbered prompts from Erlang
    * For tutorial work, I sometimes do -- however, it's a two-edged sword: as a document/tutorial develops, new code is needed and prompt numbers change. Continuing from where you left of in the REPL last week can be a pain (since you're copying prompt numbers into the docs).

So, to address this, I would ask: if we support numbered prompts, could we also update (run ...) so that when it pulls in a saved REPL session, it increments the primary prompt number for every command? So if I pulled in a last-session.lfe file which had 41 REPL command entries, after loading the file, the LFE prompt would say 42> and I could continue on in the tutorial without having to execute a dummy command 41 times ...

These are things which have been floating around in my brain -- I have no particular intense *need* for them -- they'd just make my life easier :-) If they would cause too much of a delay or be too involved, no worries from my end...

(Also, if you prefer, I can write these up in appropriate LFE tickets so they are tracked effectively.)

d

On Sun, Mar 15, 2015 at 9:07 PM, Robert Virding <rvir...@gmail.com> wrote:
I am working on the REPL, this apart from ideas in an earlier discussion on LFE initialisation, and have a few ideas. First off is that it has to be fixed in its handling of errors. Second is handling of prompts; now it just prompts on the first input line. What would people think of it prompting every line in the same way the erlang shell does?

Robert

--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.

Robert Virding

unread,
Mar 16, 2015, 6:12:53 PM3/16/15
to lisp-flavo...@googlegroups.com
That's what you get for making suggestions. :-)

My immediate plan is to first fix the error handling. It will behave in much the same way as the erlang shell with errors killing the shell process, and any processes linked to it. The next phase will be to get the handling of configuration files and the user_default module in place. Then we can start with working out what we intend to do with them.

No issues yet please, we will take then peu à peu as we go please.

Robert
This is great, Robert!

To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.

Duncan McGreggor

unread,
Mar 17, 2015, 4:05:49 PM3/17/15
to lisp-flavo...@googlegroups.com
Just wanted to say I've been chuckling about this response on and off all day :-)

(... I know that when I've caused Robert to speak French, I've gone too far!)

d

To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.

Robert Virding

unread,
Mar 17, 2015, 5:43:51 PM3/17/15
to lisp-flavo...@googlegroups.com
No worries, that was just me showing off. :-) My daughter is studying french so we play around dropping french. Btw a good way to get pick up languages is to listen to translations of Disney songs, they generally have quite decent language.

I have pushed to develop a new experimental version of the LFE repl which can handle signals properly. Please test and find faults. More will come soon.

Robert
This is great, Robert!

To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsubscri...@googlegroups.com.

To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.

Mason Staugler

unread,
Mar 17, 2015, 9:21:33 PM3/17/15
to lisp-flavo...@googlegroups.com
That version fixes the undef bug I reported.

Robert Virding

unread,
Mar 18, 2015, 5:45:22 AM3/18/15
to lisp-flavo...@googlegroups.com
That's good as it was meant to. :-)

Mason Staugler

unread,
Mar 18, 2015, 9:43:55 AM3/18/15
to lisp-flavo...@googlegroups.com
Oh, great! :) I didn't have a chance to do anything but test that last night.

Duncan McGreggor

unread,
Mar 18, 2015, 12:52:24 PM3/18/15
to lisp-flavo...@googlegroups.com
I'm not sure if the error below is due to LFE or not, but it's the REPL-bombing one I've run into most recently and still occurs with the latest from the LFE repo.

The example below attempts to use the lhttpc library without starting it. Doing so causes the shell to exit:

> (lhttpc:request "http://aasd" "GET" '() "" 10000)
*** ERROR: Shell process terminated! (^G to start new job) ***

=ERROR REPORT==== 18-Mar-2015::11:47:46 ===
Error in process <0.26.0> with exit value: {function_clause,[{lists,reverse,[{gen_server,call,[undefined,{socket,<0.48.0>,"aasd",80,false},infinity]}],[{file,"lists.erl"},{line,145}]},{lfe_lib,format_stacktrace,3,[{file,"src/lfe_lib.erl"},{line,352}]},{lfe_lib,format_exception...

Here is my version info:

> (lutil:get-versions)
(#(erlang "17")
 #(emulator "6.3")
 #(driver-version "3.1")
 #(lfe "0.10.0-dev")
 #(lutil "0.6.1"))

d


On Tue, Mar 17, 2015 at 8:21 PM, Mason Staugler <ma...@staugler.net> wrote:
That version fixes the undef bug I reported.

--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.

Robert Virding

unread,
Mar 18, 2015, 2:17:18 PM3/18/15
to lisp-flavo...@googlegroups.com
Could you try doing a

> (catch (lhttpc:request "http://aasd" "GET" '() "" 10000))

Hopefully that will give me a better display of the stacktrace. If it still "dotting out" at then end try doing

> (pp (catch (lhttpc:request "http://aasd" "GET" '() "" 10000)))

I think I know what the problem is but I need to be sure.

Robert



On Wednesday, March 18, 2015 at 5:52:24 PM UTC+1, Duncan McGreggor wrote:
I'm not sure if the error below is due to LFE or not, but it's the REPL-bombing one I've run into most recently and still occurs with the latest from the LFE repo.

The example below attempts to use the lhttpc library without starting it. Doing so causes the shell to exit:

> (lhttpc:request "http://aasd" "GET" '() "" 10000)
*** ERROR: Shell process terminated! (^G to start new job) ***

=ERROR REPORT==== 18-Mar-2015::11:47:46 ===
Error in process <0.26.0> with exit value: {function_clause,[{lists,reverse,[{gen_server,call,[undefined,{socket,<0.48.0>,"aasd",80,false},infinity]}],[{file,"lists.erl"},{line,145}]},{lfe_lib,format_stacktrace,3,[{file,"src/lfe_lib.erl"},{line,352}]},{lfe_lib,format_exception...

Here is my version info:

> (lutil:get-versions)
(#(erlang "17")
 #(emulator "6.3")
 #(driver-version "3.1")
 #(lfe "0.10.0-dev")
 #(lutil "0.6.1"))

d

On Tue, Mar 17, 2015 at 8:21 PM, Mason Staugler <ma...@staugler.net> wrote:
That version fixes the undef bug I reported.

--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.

Duncan McGreggor

unread,
Mar 18, 2015, 2:47:15 PM3/18/15
to lisp-flavo...@googlegroups.com
Trying it now ...

d

To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.

Duncan McGreggor

unread,
Mar 18, 2015, 2:55:00 PM3/18/15
to lisp-flavo...@googlegroups.com
Oh, I should have mentioned: when I tried to catch this error in code by wrapping (try ... (catch ...)), the error was not caught.

Neither of those returned any more information; here's the output:

> (pp (catch (lhttpc:request "http://aasd" "GET" '() "" 10000)))
*** ERROR: Shell process terminated! (^G to start new job) ***

=ERROR REPORT==== 18-Mar-2015::13:48:06 ===
Error in process <0.26.0> with exit value: {function_clause,[{lists,reverse,[{gen_server,call,[undefined,{socket,<0.34.0>,"aasd",80,false},infinity]}],[{file,"lists.erl"},{line,145}]},{lfe_lib,format_stacktrace,3,[{file,"src/lfe_lib.erl"},{line,352}]},{lfe_lib,format_exception...

d



To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.

Robert Virding

unread,
Mar 18, 2015, 9:30:37 PM3/18/15
to lisp-flavo...@googlegroups.com
One last request to test something. Do:

> (process_flag 'trap_exit 'true)
false

> (lhttpc:request "http://aasd" "GET" '() "" 10000)

> (c:flush)

With a bit of luck it wo'nt completely crash and I can see the signal. I don't have lhttpc downloaded.

Robert
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsubscri...@googlegroups.com.

To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.

Duncan McGreggor

unread,
Mar 18, 2015, 11:46:48 PM3/18/15
to lisp-flavo...@googlegroups.com
Huh, that's a nifty trick -- I gotta remember that one ...

Here's the output:

> (process_flag 'trap_exit 'true)
false
> (lhttpc:request "http://aasd" "GET" '() "" 10000)
#(error
  #(noproc
    #(gen_server call (undefined #(socket <0.35.0> "aasd" 80 false) infinity))))
> (c:flush)
ok
>

d


To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.

Robert Virding

unread,
Mar 27, 2015, 4:04:36 AM3/27/15
to lisp-flavo...@googlegroups.com
I have pushed a new version of the REPL to the develop branch. It should now work properly.

Robert

Robert Virding

unread,
Mar 27, 2015, 4:02:05 PM3/27/15
to lisp-flavo...@googlegroups.com
Work properly in this case means handling errors in commands and started processes sensibly. More like the erlang shell does.

Robert

Duncan McGreggor

unread,
Mar 27, 2015, 4:16:19 PM3/27/15
to lisp-flavo...@googlegroups.com
Perfect! Just tried it out on the lhttpc-not-started issue, and it works like a charm :-D

Thanks, Robert!

d

To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.

Robert Virding

unread,
Apr 6, 2015, 5:37:37 PM4/6/15
to lisp-flavo...@googlegroups.com
These fixes to the REPL and a few other goodies have been merged into 'master' and pushed to github. The commit has tags v0.9.2 and 0.9.2 (until we resolve which alternative to use).

Robert
Reply all
Reply to author
Forward
0 new messages