dante icon indicating copy to clipboard operation
dante copied to clipboard

Initialization blocks for REPLoid

Open ttuegel opened this issue 8 years ago • 12 comments

I like to call out to R with inline-r from my Haskell buffers. This requires that I initialize R in a particular way, so I have a code block at the top of the file with the appropriate commands. But, that requires that I remember to run that block before I try to evaluate any other code blocks! It would be nice to be able to designate an "initialization" block that is guaranteed to be run before any other code blocks in a buffer.

ttuegel avatar Apr 26 '17 15:04 ttuegel

This feature requires some design. It may also be generalized in some directions (sessions, general notion of state, etc.). I think that we should use this ticket to have a discussion before diving into an implementation.

jyp avatar Apr 30 '17 19:04 jyp

I've just added multi-stanza blocks. Let me know if that helps.

jyp avatar Oct 01 '17 20:10 jyp

I'm thinking at the moment to drop the idea of having long-term sessions and state. The reason is that for flychecking purposes dante loads and reloads modules constantly. Keeping a session open would require a nother ghci instance running (like intero does) and I believe that the price/performance ratio is too high. (@dabro)

I may get into implementing plain initialization blocks later.

jyp avatar Oct 02 '17 09:10 jyp

@jyp I think the 2nd GHCi session cost is already being paid somewhere. Either we're using the haskell-interactive-mode repl, or opening one up somewhere else. Who doesn't have a need for sessions during development?

Maybe integrating the haskell-mode repl?

On the upside of the current setup, the user does make the choice as to whether to load and use that 2nd repl, and which modules to load (and when).

dabro avatar Oct 02 '17 14:10 dabro

The cost is in me maintaining the complexity :)

Another reason for not having a state is that IMO, the style of interaction which dante has does not make obvious that there is a session open and what happens in it at any time. In fact it tries hard to hide the prompt, etc. I would encourage users to use a simple comint-based mode for ghci if there goal is to maintain long-lived sessions.

On Mon, Oct 2, 2017 at 4:21 PM, dabro [email protected] wrote:

@jyp https://github.com/jyp I think the 2nd GHCi session cost is already being paid somewhere. Either we're using the haskell-interactive-mode repl, or opening one up somewhere else. Who doesn't have a need for sessions during development?

Maybe integrating the haskell-mode repl?

On the upside of the current setup, the user does make the choice as to whether to load and use that 2nd repl, and which modules to load (and when).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jyp/dante/issues/15#issuecomment-333549147, or mute the thread https://github.com/notifications/unsubscribe-auth/AABsY36AKAVttrNYIoJD98ctIBgEoOv5ks5soPF1gaJpZM4NJC0e .

jyp avatar Oct 02 '17 14:10 jyp

All makes lots of sense. Thanks.

Awesome product.

On Oct 2, 2017, at 9:28 AM, Jean-Philippe Bernardy [email protected] wrote:

The cost is in me maintaining the complexity :)

Another reason for not having a state is that IMO, the style of interaction which dante has does not make obvious that there is a session open and what happens in it at any time. In fact it tries hard to hide the prompt, etc. I would encourage users to use a simple comint-based mode for ghci if there goal is to maintain long-lived sessions.

On Mon, Oct 2, 2017 at 4:21 PM, dabro [email protected] wrote:

@jyp https://github.com/jyp I think the 2nd GHCi session cost is already being paid somewhere. Either we're using the haskell-interactive-mode repl, or opening one up somewhere else. Who doesn't have a need for sessions during development?

Maybe integrating the haskell-mode repl?

On the upside of the current setup, the user does make the choice as to whether to load and use that 2nd repl, and which modules to load (and when).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jyp/dante/issues/15#issuecomment-333549147, or mute the thread https://github.com/notifications/unsubscribe-auth/AABsY36AKAVttrNYIoJD98ctIBgEoOv5ks5soPF1gaJpZM4NJC0e .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jyp/dante/issues/15#issuecomment-333551309, or mute the thread https://github.com/notifications/unsubscribe-auth/AInFRVCJfe8rFNr8m4ThDPE6OZPOdvTaks5soPMUgaJpZM4NJC0e.

dabro avatar Oct 02 '17 22:10 dabro

should we close this as wontfix? I think I agree with @jyp about keeping the block evals simple.

maybe we can make a dante-yank-block command, so the block can then be pasted into your own ghci buffer. since it already exists internally, and it let's you write doctests with the same formatting, whether or not they need initialization.

sboosali avatar Nov 28 '17 22:11 sboosali

@sboosali I'm thinking that an initialization block per file is a good idea, in fact. This could be implemented by running the initialization block every time that a reploid block is evaluated. (And so there is little complexity overhead)

jyp avatar Nov 29 '17 08:11 jyp

This feature should follow the https://github.com/sol/doctest spec.

jyp avatar Jan 26 '18 08:01 jyp

By spec, you mean the syntax and behavior of stuff like

$setup

right? Doesn't that require some parsing of the source, like the comments and imports?

sboosali avatar Jan 27 '18 00:01 sboosali

I am plannig to simply regexp search "-- $setup" or similar.

jyp avatar Jan 27 '18 19:01 jyp

yeah, same :-)

sboosali avatar Jan 27 '18 23:01 sboosali