JShell.setIdGenerator/setTempVariableNameGenerator

Paul Sandoz paul.sandoz at oracle.com
Thu Jul 23 10:27:06 UTC 2015


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