JShell.setIdGenerator/setTempVariableNameGenerator

Robert Field robert.field at oracle.com
Thu Jul 23 16:31:51 UTC 2015


Paul,

I don't want two different ways to create an instance -- that adds unneeded 
complexity.  I don't want to blend the builder functionality into the 
dynamic functionality, that defeats the goal of separating out the 
functionality that is obscure, set-up related, and one-time from that that 
is state-bound and dynamic.

This is a tool API. The number of people who will have to type "new 
JShell.Builder().build()" in small.

-Robert



On July 23, 2015 3:27:05 AM Paul Sandoz <paul.sandoz at oracle.com> wrote:

>
> On 23 Jul 2015, at 06:31, Robert Field <robert.field at oracle.com> wrote:
>
> >
> > On 07/22/15 01:25, Paul Sandoz wrote:
> >> Hi Robert,
> >>
> >> Do you consider that the generator functions should be provided to the 
> JShell factory method? or would there be a need to override during a shell 
> session?
> >>
> >> Perhaps a builder API is required? that would be a reasonable way to 
> hide these advanced methods as developers will never notice for the common 
> case of default construction, and it would allow for other configuration 
> (if any is required).
> >>
> >> Paul.
> >
> > I've switched to a Builder pattern.  Looks clean in practice (JShell 
> tool, examples, and tests)..
> >
>
> Yes, looks good. My inclination is to have:
>
>   JShell js = JShell.create();
>
> for the default, rather than having to do:
>
>   JShell js = new JShell.Builder().build();
>
> Might need to state that the once a builder has built a JShell instance it 
> can be reused to build further ones.
>
> Do you envisage cases where a JShell might not create a remote process and 
> perhaps execute under some restrictions when evaluating expressions? I am 
> thinking of possible future cases such as integration with the scripting 
> API where runtime context may be passed so the shell can interact with 
> existing state.
>
> Paul.
>
> > Didn't do Brian's suggestion of moving event registration into the 
> builder yet -- waiting on answer to my concerns.
> >
> > -Robert
> >
>




More information about the kulla-dev mailing list