develooper Front page | perl.perl5.porters | Postings from January 2014

Re: [perl #120941] The => operator doesn't quote v-strings in "useconstant v1 => 42"

Thread Previous | Thread Next
From:
Brad Gilbert
Date:
January 7, 2014 16:12
Subject:
Re: [perl #120941] The => operator doesn't quote v-strings in "useconstant v1 => 42"
Message ID:
CAD2L-T3nYO8kX+ZtcOELmmLkUh0+i-DAVnYyjF7-aKfeT4ya0A@mail.gmail.com
On Tue, Jan 7, 2014 at 3:04 AM, Johan Vromans <jvromans@squirrel.nl> wrote:
> Brad Gilbert <b2gills@gmail.com> writes:
>
>> I would expect that to be the equivalent to `use constant ('v1',1)`
>
> Yes, but the syntax of 'use' is (perdoc -f):
>
>   use Module VERSION LIST
>
> and not
>
>   use Module VERSION , LIST
>
> (note the comma).
>
> So in
>
>   use Module X,Y,Z;
>
> X,Y,Z is the LIST part, even if X resembles a version number. The
> correct invocation for the latter is
>
>   use Module X Y,Z;
>

I said it is being parsed as the version part, not that is what I expected.
What I meant was that I expected it to be essentially the same as:

    use constant; sub v1(){1}

That is I would have expected it to be parsed as the first item
in the list, not the minimum version.

Which is why I also said it would make it difficult to create a v-string
with a single element of ordinal 1.

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