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

Re: Functional-style pattern matching

Thread Previous | Thread Next
From:
Mark J. Reed
Date:
March 10, 2010 04:39
Subject:
Re: Functional-style pattern matching
Message ID:
f60fe001003100439o75a94791re3ed8af90d332925@mail.gmail.com
Does the unpacking participate in dispatch?  If a Hash comes in as $t
with no 'left' key, will it fail to match?


On Tuesday, March 9, 2010, Little Walker <endah@dircon.co.uk> wrote:
>> Which is pretty powerful, really.
>
> Absolutely - I think you're referring to the 'type subset' stuff which
> is great.
>
>> This is where Perl 6 is not the same as functional
>> languages, since it's got an imperative OO element as well.
>
> True, there can be friction between the functional style and OO, but
> look at how Scala manages it with case classes.  When you look at the
> implementation, really it boils down to syntactic sugar but then so do
> many of the cool new features in Perl 6!
>
> I bring this up because when thinking of what will be possible with
> lazy evaluation, junctions, named parameter shorthand, closures, etc.,
> etc., somehow pattern matching screams out at me.  It can be concise,
> expressive and unambiguous, and very complementary to Perl 6's
> existing feature set.  I know a lot of work went into bringing
> functional and OO together to make Scala happen, so certainly there
> may be impracticalities in just 'adding pattern matching'.
>
> Scala case classes: http://www.scala-lang.org/node/107 or
> http://programming-scala.labs.oreilly.com/ch06.html#CaseClasses
>
>

-- 
Mark J. Reed <markjreed@gmail.com>

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