>>>>> "Peter" == Peter Scott <[EMAIL PROTECTED]> writes:

Peter> At 12:13 PM 6/21/01 -0700, Randal L. Schwartz wrote:
Me> main is the name of a namespace.
>> 
>> You might as well say "main is a noun".  It's about as meaningful.
>> "main" is a package name, not a namespace.  Packages distinguish the
>> parts of a global symbol table, which is ONE namespace.  $main::a and
>> $foo::b are just two equally valid names in the one single global
>> symbol table.  To artificially distinguish those two as being members
>> of seperate "namespaces" is to introduce confusion.  Perhaps you are
>> merely presenting the confusion you already have. :)

Peter> Quoth perlmod:

Peter> "Perl provides a mechanism for alternative namespaces to protect
Peter> packages from stomping on each other's variables. In fact, there's
Peter> really no such thing as a global variable in Perl. The package
Peter> statement declares the compilation unit as being in the given
Peter> namespace."

>> These are points that either you don't have clear (from reading your
>> stuff), or you are deliberately muddying, and I think with devastating
>> results.

Peter> On the namespace point, seems a bit harsh given the precedent in the
Peter> documentation.

Hmm.  That section of perlmod also is contrary to how it actually
works.  I wonder if there's a different meaning for "global" there.  I
can read it different ways, some of which supports what I said
earlier, and some of which contradicts it.

Ahh, I think I see the problem.  The syntax for $foo actually means
the variable $main::foo (when main is the current package), and
$main::foo is a global variable, but $foo is a "local to the package"
variable.  So perlmod is arguing it from a syntax point of view, and
I'm arguing it from a semantics point of view.  I think the semantics
underlying the syntax are important, and should be understood first.
perlmod jumps right to syntax, leading to people thinking there's a
"MY package" which causes loud cognitive dissonance in my ears.

I wonder if I shouldn't pretty-up my recap and submit it as a
docpatch, which I think would probably reduce further
misunderstanding.

We take a stab at this in the new llama, although we don't mention
package except to look at the pretty colons in a "use" directive.

A llama-sequel (alpaca? :) book might address that head-on though, at
the level and quality of explanation in the llama.  Hmm, I wonder if
there's one of those in the works now that Tom Phoenix and I are done
with the llama? :-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to