develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #119455] [EXPERIMENT] pluggable keyword API

Thread Previous | Thread Next
From:
Eric Brine
Date:
September 30, 2013 13:29
Subject:
Re: [perl #119455] [EXPERIMENT] pluggable keyword API
Message ID:
CALJW-qHALoJLzhouGyyD50Vbrm7OFt=Kaq-hHUNVndr3T_zn7A@mail.gmail.com
On Sun, Sep 29, 2013 at 4:15 PM, Lukas Mai <plokinom@gmail.com> wrote:

> On 29.09.2013 17:46, Eric Brine wrote:
> > On Wed, Aug 28, 2013 at 3:52 PM, Lukas Mai <plokinom@gmail.com
> > <mailto:plokinom@gmail.com>> wrote:
> >
> >     I've been thinking about creating a branch to convert
> >     Function::Parameters to D:CP. I've hit two problems so far:
> >
> >     1) There's no documentation that tells you how you actually
> integrate it
> >     in a distribution. There's only this in the synopsis:
> >
> >     [...]
> >     2) Function::Parameters is a lexical pragma. Does D:CP provide
> lexical
> >     exports? I don't see how to get the effect of lexically scoped
> keywords
> >     with plain subs.
> >
> >
> > For both, take a look at Syntax::Feature::Loop. Feel free to ask me if
> > you have any questions.
>
> I've given up on D:CP for now. It simply doesn't provide the right
> look-and-feel for keywords.
>
> I've found a few weird things in Syntax::Feature::Loop, though:
>
> % perl -we 'use syntax "loop"; loop()'
> syntax error at -e line 1, near "loop("
> syntax error at -e line 1, near "()
> "
> Execution of -e aborted due to compilation errors.
>

> That's not very helpful. (Also, why 2 syntax errors?)
>

Not helpful? It's the exact same error message found elsewhere.

>perl -e"for{}"
syntax error at -e line 1, near "for{"
Execution of -e aborted due to compilation errors.

In fact, the error is emitted by Perl itself.  I'll look into why it's
giving two errors.



> % perl -we 'use syntax "loop"; &loop()'
> Undefined subroutine &Syntax::Feature::Loop::loop called at -e line 1.
>
> Why is it trying to call Syntax::Feature::Loop::loop instead of
> main::loop when that sub doesn't even exist?
>

There's a difference between existing and being defined. While the sub
exists, it's not defined.


> % perl -we 'use syntax "loop"; sub loop {} &loop()'
> Undefined subroutine &Syntax::Feature::Loop::loop called at -e line 1.
>
> That simply shouldn't happen. I have a perfectly fine &main::loop right
> there.
>

Yes, but you said to use the one from S::F::L. Defining a sub doesn't
override keywords.

>perl -E"sub for { } for('abc');"
syntax error at -e line 1, near ");"
Execution of -e aborted due to compilation errors.

>perl -E"sub lc { 'b' } say lc 'a'"
a

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About