xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

Below is mentioned in perl6 syn:

As in Perl 5, a module is just a kind of package. Unlike in Perl 5, modules and classes are declared with separate keywords, but they're still just packages with extra behaviors.

To my surprise, That might mean We just say 'use Module' at any time!

Why do I say so?

We must say 'Module ...' if we make own module because we need export symbols. Meanwhile, because module is also a package, we don't need say 'Package ...' to create namespace of module symbols. Furthermore, at any scenes that we need to use package to distinguish symbols(like package variables or package functions), we can simply substitute 'Package ...;' by 'Module ...'.

So, Package is just a concept in perl6 but never be used, isn't it?

A superficial thought, I'm looking forward to guru's reply!


I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re: Package is useless in Perl6?
by Limbic~Region (Chancellor) on Nov 04, 2008 at 15:15 UTC
    xiaoyafeng,
    Your node may be confusing to those following along at home. For those interested, the relavent synopses are packages, modules, and objects.

    Unlike perl 5 which really only gave you one way to define a namespace (package), perl 6 will give you several which will help better define what that name space is doing. This is somewhat synonomous with the restriction of defining methods and functions in perl 5 with sub where perl 6 will have different keywords. Because they are defined with different keywords, they can have different behaviors. The same goes with the differences in packages, modules, and classes.

    Update: Oh, and package is absolutely necessary if you intend to mix and match perl 5 and perl 6.

    Cheers - L~R

Re: Package is useless in Perl6?
by Anonymous Monk on Nov 04, 2008 at 14:46 UTC
    So, Package is just a concept in perl6 but never be used, isn't it?
    Except when its used :)
      Except when [it's] used
      ... to explain Perl 6 classes and modules to someone with a Perl 5 background. E.g., "Well, it's like package in Perl 5 except ..."

      Otherwise, there's no need to refer to Perl 5 packages; simply explain Perl 6 classes and modules.

        There never need be a need for have or want :)