develooper Front page | perl.perl5.porters | Postings from May 2010

Re: package block syntax

Thread Previous | Thread Next
From:
chromatic
Date:
May 19, 2010 10:09
Subject:
Re: package block syntax
Message ID:
201005191009.35499.chromatic@wgz.org
On Wednesday 19 May 2010 at 09:39, Zefram  wrote:

> I'm pretty sure that's not the case with package block.  The syntactic
> equivalence of "package Foo { ... }" with "{ package Foo; ... }" is a
> quite complete and precise description both of the effect that I'm aiming
> for and of how it's implemented.  So I don't think there's room for
> surprises in this case.  I totally accept the issue in the general case.

I experimented with the syntax for a while myself.  The only possible point of 
surprise I could produce is if a user wrote:

	package Parent {
		...

		package Child {
			...
		}
	}

... and expected a nested namespace relationship.  Perl 5's behavior here is 
no different than if you write:

	{
		package Parent;
		...

		{
			package Child;
			...
		}
	}

... but the existing syntax seems not to support that idea.

I'm not suggesting any changes to namespace visibility or namespace nesting.  
I mention this only to ask if the documentation should explain that no such 
namespace nesting exists.

-- c

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