home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7532 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.8 KB  |  36 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!news.cerf.net!netlabs!lwall
  3. From: lwall@netlabs.com (Larry Wall)
  4. Subject: Re: Package & Namespace Question
  5. Message-ID: <1992Dec17.210221.21875@netlabs.com>
  6. Sender: news@netlabs.com
  7. Nntp-Posting-Host: scalpel.netlabs.com
  8. Organization: NetLabs, Inc.
  9. References: <BzD4Hw.AG8@da_vinci.it.uswc.uswest.com>
  10. Date: Thu, 17 Dec 1992 21:02:21 GMT
  11. Lines: 23
  12.  
  13. In article <BzD4Hw.AG8@da_vinci.it.uswc.uswest.com> rray@lookout.it.uswc.uswest.com (Randy J. Ray) writes:
  14. : Why is it that: when calling subroutines defined in the main namespace from
  15. : within some package, you must explicitly refer to main? Why is there not some
  16. : syntactical rule that says, "If this routine is not defined at this level,
  17. : look for it in main before reporting an error"? I can understand specifying
  18. : &main'phred() when you want to use that instead of a package-defined &phred.
  19. : Is it that main is not necessarily above other packages in hierarchy, and
  20. : therefore it is not the natural progression to look for those routines
  21. : elsewhere?
  22.  
  23. There is no namespace hierarchy in Perl4.  There is likely to be one in
  24. Perl5, but I think you'd have to explicitly declare something like
  25. "package main'foo" to place package foo under package main.  The
  26. primary motivation for nesting packages would be to provide inheritance
  27. of object methods, and I don't see the need offhand for every class to
  28. derive from package main.  If you've got a good reason to do so, now is
  29. the time to let me know.  I may be hubristic, but I'm not proud.  :-)
  30.  
  31. I'll go so far as to claim that in certain fortuitous ways, I'm kinda
  32. stupid.  I'm not particularly proud of being stupid, but that's why Perl
  33. is understandable to the huddled masses.  Call it the Pooh Approach.
  34.  
  35. Larry
  36.