develooper Front page | perl.perl6.language | Postings from September 2006

Re: RFC: multi assertions/prototypes: a step toward programming by contract

Thread Previous | Thread Next
From:
Larry Wall
Date:
September 29, 2006 13:24
Subject:
Re: RFC: multi assertions/prototypes: a step toward programming by contract
Message ID:
20060929202412.GA31696@wall.org
On Fri, Sep 29, 2006 at 02:05:06PM -0400, Mark J. Reed wrote:
: On 9/29/06, Jonathan Lang <dataweaver@gmail.com> wrote:
: >Terminology issue: IIRC (and please correct me if I'm wrong), Perl 6
: >uses 'module' to refer to 'a perl 5-or-earlier module', and uses
: >'package' to refer to the perl 6-or-later equivalent.
: 
: 
: Other way around.  "package" is Perl 5, because that's the P5 keyword,
: and seeing a "package" declaration is an indicator to Perl6 that the
: file it's processing is written in P5.  In P6, there are both
: "module"s and "class"es, but no "package"s other than those inherited
: from P5 code..

That is ever so slightly overstated.  We still have packages as a
native notion in P6.  The "'package' indicates P5" thing is just if
the first thing in the file is a package declaration, but elsewhere
in Perl 6 you're allowed to say:

    package Foo { our $bar = 3 }

and such.  Our bare unvarnished namespaces are still called "packages",
but in terms of roles, Module does Package just as Class does Module
(and by implication, Package).  Same for roles and subsets and enums.
Basically, all types do Package whenever they need an associated
namespace.  And most of the Package role is simply:

    method postfix:<::> () { return %.HOW.packagehash }

or some such, so "$type.::" returns the symbol table hash associated
with the type, if any.  It's mostly just a convention that the Foo
prototype and the Foo:: package are considered interchangable for
most purposes.

Larry

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