On Thu, Feb 25, 2010 at 7:49 PM, Ben <mi...@emerose.org> wrote:
>> I think you are looking for a different object model than proto
>> offers.  There aren't many languages that offer the prototype object
>> model.
>
> Yes, your probably right---I don't have much experience using the
> prototype model.  This is the way I expected it to work:
>
>> z <- 1
>> p <- proto(expr={a <- z})
>> p$a
> [1] 1
>> p$z
> Error in get(x, env = this, inherits = inh) : variable "z" was not found

> library(mutatr)
>
> z <- 1
> p <- Object$clone()$do({
+   self$a <- z
+ })
> p$a
[1] 1
> p$z
Error: Field z not found in Object <0x1022b66d8>

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to