Rolf Turner <r.tur...@auckland.ac.nz> writes:

> On 7/04/2009, at 3:34 PM, Ken-JP wrote:
>
>       <snip>
>
>> Using NAMESPACE, I was able to hide my globals behind a  "." (eg
>> .myGlobal
>> <<- 72) and use exportPattern("^[^\\.]*") to prevent users from
>> seeing my
>> globals, yet I was able to access their values inside my package.
>
>       <snip>
>
>       WHY do you want to ``prevent users from seeing [your] globals''?
>
>       The whole point of R (well, maybe not the whole point, but a major
>       point) is to be adaptable.  If something doesn't work the way a user
>       wants, then the user can change things.  When the inner workings
>       are hidden so deeply that the user can't see what to change, this
>       becomes effectively impossible, and the user might as well go and
>       use SAS.
>
>       I exaggerate but slightly.
>
>       Nevertheless, this syndrome of hiding things and making them
>       effectively
>       inaccessible --- which seems to have become an obsession with some

ls(getNamespace("<pkg>"), all=TRUE)

gets all the symbol names.

<pkg>:::symbol

gets non-exported values. What does the 'user' get in return? A
cleaner interface to the important functionality of the package,
faster symbol lookup, reduced opportunities for symbol masking between
packages. And with use of Imports:, unambiguous symbol look-up within
the package and shorter symbol search path.

Martin

>       of the
>       R community, particularly many of the senior members --- bugs the
>       living
>       Drambuie out of me.
>
>               cheers,
>
>                       Rolf Turner
>
> ######################################################################
> Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to