> To: R-devel@stat.math.ethz.ch > Subject: Apropos names. > From: Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> > Date: 19 Mar 1998 18:44:14 +0100 > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit> (from R-core) > > Btw, why can't object names contain a `@'?Reserved for future use?> Speaking of names. I've been thinking whether it would not at some > point be wise to introduce namespaces into R. This would pretty > obviously break a lot of S code, but it would also make it possible to > avoid a lot of silly problems such as naming one's variables c, t, pt, > df, rm, ... > > A plan that might work relatively smoothly could involve: > > - Separate functions from variables. We already do that to some extent > ("looking for object of mode function...") [At the same time, one > might get rid of everyone's favourite quirk: forgetting () and > thus listing the function instead of calling it. I know: basic > design, functions are just objects, etc., but really: Wouldn't it be > nicer to type view(ls) the few times you actually wanted to see its > contents?]This has been done in common lisp and it's ugly. Consider apply(x, 1, mean) How do we indicate that this is the function called mean rather than the non-function mean? The single namespace makes it much easier to think about functions as data.> - All system functions and variables are really named something like > sys::c() i.e. we introduce a namespace separator ::. > Functions/variables that are intended for general use can be made > public, by a special call.This is a definite possibility, but there are higher priorities at present. Ross -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Ross Ihaka <ihaka@stat.auckland.ac.nz> writes:> > > Speaking of names. I've been thinking whether it would not at some > > point be wise to introduce namespaces into R. This would pretty > > obviously break a lot of S code, but it would also make it possible to > > avoid a lot of silly problems such as naming one's variables c, t, pt, > > df, rm, ... > > > > A plan that might work relatively smoothly could involve: > > > > - Separate functions from variables. We already do that to some extent > > ("looking for object of mode function...") [At the same time, one > > design, functions are just objects, etc., but really: Wouldn't it be > > nicer to type view(ls) the few times you actually wanted to see its > > contents?] > > This has been done in common lisp and it's ugly. Consider > > apply(x, 1, mean) > > How do we indicate that this is the function called mean rather > than the non-function mean? The single namespace makes it much > easier to think about functions as data.Ugh. You're right. An even clearer bit of ugliness is mean<-mean(x) # you'll be surprised at how many people will do that! as.list(mean) # which one?? Hmm. Plan B: class(c)<-"system" class(ls)<-"system" ... print.system<-function(...)warning(-something-) "<-.system"<- function(...)error(-something-) if you catch my drift? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Reasonably Related Threads
- R-alpha: apropos() available
- S Compatibility (Was: Re: R-beta: 'all.names' function -- failing as.list( _function_ ))
- Apropos the day...
- What happened to Ross Ihaka's proposal for a Common Lisp based R successor?
- What happened to Ross Ihaka's proposal for a Common Lisp based R successor?