On Thu Jan 30 07:15:52 2014, pmichaud wrote:
> On Wed, Jan 29, 2014 at 06:14:38PM -0800, Mark E. Shoulson wrote:
> >  Consider:
> >
> > multi sub f1(Any $x) { "Any $x" }
> > multi sub f2(Any $x) { f1($x) }
> > multi sub f1(Rat $x) { "Rat $x" }
> >
> > say f2("a");
> > say f2(1.9);
> > say f1(1.9);
> 
> The way the REPL works is that each line of entered input
> ends up in its own (nested) lexical scope.  We've yet to
> find a good solution around this -- in order to complete
> compilation and execution of a line, we kinda have to make
> the current lexical scope concrete.  This is at least
> implied in several sections of the synopses, where the lexical
> symbol table is considered static after compilation completes
> ("CHECK" time, I believe).
> 
> Thus when the lines above are entered one at a time,
> the REPL treats it as:
> 
>    { 
>      multi sub f1(Any $x) { "Any $x" }
> 
>      { 
>        multi sub f2(Any $x) { f1($x) }
> 
>        { 
>          multi sub f1(Rat $x) { "Rat $x" }
> 
>          { 
>            say f2("a");
> 
>            { 
>              say f2(1.9);
> 
>              { 
>                say f1(1.9);
>              }
>            }
>          }
>        }
>      }
>    }
> 
> So, when f2() is executed, the f1(Rat) multi isn't in scope and
> never gets called.
> 
> To think of it another way -- each line of input to the REPL
> is treated like a nested EVAL, thus resulting in its own lexical
> scope.
> 
> At the moment I'm inclined to reject this ticket as "not a bug",
> since Perl 6.0 design seems to constrain anything REPL-like to
> work this way.  But perhaps someone sees a way to have lexical
> scopes that can be more dynamic/interactive, so I'll give time
> for other opinions before closing this.
> 
> Pm

Rejecting ticket.

-- 
Will "Coke" Coleda

Reply via email to