From Waclaw.Marcin.Kusnierczyk at idi.ntnu.no  Wed Nov 19 13:24:26 2008
From: Waclaw.Marcin.Kusnierczyk at idi.ntnu.no (Wacek Kusnierczyk)
Date: Wed, 19 Nov 2008 13:24:26 +0100
Subject: [Rd] assign("FALSE", TRUE)
In-Reply-To: <18723.56931.862548.444327@stat.math.ethz.ch>
References: <3EFAB5FA-61AF-4646-8C17-288838AB075B@auckland.ac.nz>	<18721.60440.551783.840625@cmath-5.math.ethz.ch>	<4921F798.6010006@biostat.ku.dk>	<18722.49097.70529.650997@stat.math.ethz.ch>	<4922CC08.40301@biostat.ku.dk>
	<18723.56931.862548.444327@stat.math.ethz.ch>
Message-ID: <4924057A.3040707@idi.ntnu.no>

Martin Maechler wrote:
> but notably not mainly by the above. I'd consider the backtick
> operator as -- very nice -- syntactic sugar for  
> assign() and get().
>
> And, for "normal" identifiers,
>
>     foo   <- 1
>     `foo` <- 1
>     assign("foo", 1)
>   

"foo" <- 1
# same effect as above

> and 
>     foo
>     `foo`
>     get("foo")
>   

"foo"
# not 1?

(that is to say, i find this a tiny little bit incoherent, but perhaps
useful for assignments, as " is easier to get from my keyboard than `)

> are each three-fold equivalent.  If a user does not *know* about
> keywords/reserved words, (s)he can get a bit confused by 
> how e.g. break or `break` e.g. are handled:
> Recall that Joe Average User does not know about assign, get,
> `..` etc, but does know about  ls()  and typing an object name:
> If he does ls(), sees "break"  (which stems from previous
> assign("break", 3) or `break` <- 3)
> and then types 
>   > break
>   or 
>   > str(break)
>   
btw. i find the following sequence of error messages a tiny little bit
confusing:

break(1)
# Error: no loop to break from, jumping to top level

"break" = function(arg) arg
break(1)
# Error in break : argument "arg" is missing, with no default

"break" = function(arg=1) arg
break(1)
# Error: attempt to apply non-function

"if" = function(arg) arg
if(1)
# keeps waiting for more input
if(1) 2
# Error in if (1) 2 : unused argument(s) (2)


vQ



[Rd] assign("FALSE", TRUE)
Wacek Kusnierczyk