in reply to Re: 'use' inside or outside of package declaration?
in thread 'use' inside or outside of package declaration?

It is very important that package be the first non-comment token in a module.

Replies are listed 'Best First'.
Re^3: 'use' inside or outside of package declaration?
by BrowserUk (Patriarch) on May 11, 2011 at 19:39 UTC

    Because?

      Because otherwise some of the pragmata will misbehave, because then you don’t enclue Perl6 that it’s come across a Perl5 module, and because it gratuitously complicates the tool-chain.
        1. Because otherwise some of the pragmata will misbehave

          No. The pragmas (there is no such word in english as "pragmata"), behave exactly as they should.

          That is, the only pragma I use preceding the package statement, strict, functions perfectly both within the package and in the main at the end of the package.

          Equally, -w works just fine also.

        2. because then you don’t enclue Perl6 that it’s come across a Perl5 module,

          In the increasingly unlikely event that Perl6 is ever a real consideration, I seriously doubt that it will realistically be able to handle unmodified Perl5 modules reliably anyway.

          I would fully expect to have to re-work all of my modules for Perl6 to some degree, and that small thing would likely be the least problem of all. But I don't see any sign that I will be troubled to need to do so in the foreseeable future.

        3. and because it gratuitously complicates the tool-chain.

          "The tool-chain". What a wonderfully vague strawman that is.

          If there are tools out there that rely on such placement--that is neither mandated nor even advised by the language specification--then those tools are broken, "gratuitously" so, and should be fixed.

          Would you buy a hammer that required that all the nails you drive with it be vertically oriented, point down? Of course you wouldn't.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        A reply falls below the community's threshold of quality. You may see it by logging in.