develooper Front page | perl.perl6.language | Postings from March 2005

Re: some misc Perl 6 questions

Thread Previous | Thread Next
Darren Duncan
March 9, 2005 13:25
Re: some misc Perl 6 questions
Message ID:
At 10:03 AM -0800 3/9/05, Larry Wall wrote:
>On Wed, Mar 09, 2005 at 06:51:43PM +0100, Thomas Sandlaß wrote:
>: Larry Wall wrote:
>: >and it seems to me that you could simplify all that to just
>: >
>: >    subtype KeyName of Str where { m/^\w+$/ }
>: >
>: >If that succeeds, you know it's defined and non-null.
>: My view is that typing strings by means of patterns should always
>: exhaust the string as the above pattern does. I can imagine some
>: magic that lets
>: my KeyName @a = "First Second";
>: allow to actually have two entries @a[0] eq "First"
>: and @a[1] eq "Second" by somehow morphing the pattern into
>: continued matching mode where the next index continues where
>: the previous left off---and skipping whitespace.
>That's...sick...  I love it.  *Please* don't tell Damian.

However, with my particular use I wouldn't want 
that to happen; I would want the assignment to 
just fail with an error.

If we're going to do what you want, we should 
have some way of specifying which of the 
behaviours we want using different syntax around 
the rule definition.

Incidentally, I noticed that '@a = "First 
Second"' looked a lot like the reverse of what 
'$b = "@a"' did in Perl 5.

-- Darren Duncan

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About