Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

With a huge nested tuple in scope, all expressions take 30 seconds to complete #160

Open
endlessoblivion opened this issue Nov 30, 2017 · 3 comments

Comments

@endlessoblivion
Copy link

endlessoblivion commented Nov 30, 2017

After defining a sequence of functions like:

nest = (,,,,,,,,)
n0 = nest
n1 = nest n0 n0 n0 n0 n0 n0 n0 n0 n0 -- sorry, I didn't find a way
n2 = nest n1 n1 n1 n1 n1 n1 n1 n1 n1 -- how to do it via recursion
n3 = nest n2 n2 n2 n2 n2 n2 n2 n2 n2 -- or by spreading a list
n4 = nest n3 n3 n3 n3 n3 n3 n3 n3 n3
n5 = nest n4 n4 n4 n4 n4 n4 n4 n4 n4

all following expressions take a long time (20-60 seconds) to complete:

> 42
-- nothing happens for 20 s, then REPL prints
42 : number

[Elm 0.18 / ubuntu]

@process-bot
Copy link

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@zwilias
Copy link
Member

zwilias commented Nov 30, 2017

While using the REPL, each expression is recorded and replayed whenever a new expression is entered, the final value being the one that is printed out. This allows doing stuff like

> import MyModule exposing (foo)
> foo "bar"
-- notice a bug, go fix it in code
> foo "bar"
-- ahh, all good.

Since a huge nested expression like the one you typed takes some time to compile and evaluate, every subsequent expression also needs to spend that time.

Note that you can reset the environment (hence clearing out the recorded history) using :reset.

@endlessoblivion
Copy link
Author

endlessoblivion commented Dec 27, 2017

Well, that explains the apparent behaviour, and while I understand the "hot-fix propagation" reasoning behind that, it still seems to deviate from the least surprise principle, i.e. what is reasonably expected from any REPL.

Indeed, I'd rather issue a (hypothetical) :replay command explicitly, while having the runtime context be kept in memory all along by default instead. But that's of course a highly subjective POV.

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

No branches or pull requests

3 participants