Displaying 20 results from an estimated 6000 matches similar to: "From Java to R OOP"
2009 Feb 17
4
[LLVMdev] Parametric polymorphism
I'm a newcomer to llvm, but what you've done so far is very impressive.
Llvm is a godsend to anybody who is attempting to implement their own
their own language. :-) My company is considering using llvm as the
backend for a small matlab-like language for scientific computation; our
other option is MSIL.
After reading through the documentation, I noticed that llvm seems to
have one major
2009 Feb 18
2
[LLVMdev] Parametric polymorphism
> I think the problem is deeper than that, in that LLVM has no official
> concept of a subtype, so I don't see how the idea of polymorphism
> could be defined in it.
Parametric polymorphism is different from subtype polymorphism; you
can have one without the other. Parametric polymorphism just means
that you can use type variables (like T) in the IR, which are later
instantiated
to
2012 Feb 14
0
Modular coding in R, OOP
Hi all,
I've been having a look to all OOP functionallity in R, basically I've been
reading "Statistics and Computing" book by Chambers. My problem is that I'm
thinking about refactoring many functions of the applications I work with
(which is quite huge), in order to modularize its components. I believe that
trying to use OOP functionality may help to reorganize and
2012 Oct 17
1
Do *not* pass '...' to NextMethod() - it'll do it for you; missing documentation, a bug or just me?
Hi,
although I've done S3 dispatching for more than a decade now, I think
I managed to overlook/avoid the following pitfall when using
NextMethod():
If you explicitly pass argument '...' to NextMethod(), you will
effectively pass those argument twice to the "next" method!
EXAMPLE:
foo0 <- function(...) UseMethod("foo0");
foo1 <- function(...)
2004 Oct 28
1
Another problem with next method
I have another problem with NextMethod. Not sure if its related
to the last problem.
In this example, we have a generic called ff with methods
for AsIs and test classes. We call the generic with an
object of AsIs class. The corresponding method adds 1 to it
and then changes the class to test followed by issuing a
NextMethod. However, that results in this error (using R
2.0.0, 2004-10-04
2010 Feb 14
1
NextMethod() example from S Programming by Venables and Ripley (page 78)
S Programming by Venables and Ripley (page 78) has the example listed
at the end of this email. However, I get the following error when I
try the example. I don't understand the descriptions of NextMethod on
its help page. Could somebody let me know how to fix the error of this
example?
> test(x)
c1
c2
Error in NextMethod() : no method to invoke
Calls: test -> test.c1 -> NextMethod
2018 Feb 22
2
How to modify dots and dispatch NextMethod
The example is invoking NextMethod via an anonymous function, which is
not allowed (see documentation for NextMethod). Normally one gets a
runtime error "'NextMethod' called from an anonymous function", but not
here as the anonymous function is called via do.call. I will fix so that
there is a runtime error in this case as well, thanks for uncovering
this problem.
I
2018 Feb 22
2
How to modify dots and dispatch NextMethod
On 02/22/2018 12:07 PM, I?aki ?car wrote:
> 2018-02-22 10:29 GMT+01:00 Tomas Kalibera <tomas.kalibera at gmail.com>:
>> The example is invoking NextMethod via an anonymous function, which is not
>> allowed (see documentation for NextMethod).
> Thanks for your response. I definitely missed that bit.
>
>> Normally one gets a runtime
>> error
2018 Sep 03
1
Moving from Structured to Object Oriented
Dear Devels,
I am not aware whether this topic was discussed earlier or not.
But it was on my mind from quite few days so ..
Are we planning for movement of samba from C to C++ or other OOP language.
If not why, reasons of yes I find quite a few...
* C++ is a highly portabl/e/ language and is often the language of
choice for multi-device, multi-platform app development.
* C++ is an
1999 Apr 16
1
NextMethod
>> One clear moral seems to be don't do anything more inside a
>> generic function than you really need to do. Keep it *very*
>> simple indeed.
>>
> I recall JMC saying something like, all generic functions
> should be one line long; a call to the appropriate UseMethod.
It certainly is encouraging to know that others also have been confused by
aspects of
2006 Mar 07
3
Making an S3 object act like a data.frame
"[.ggobiDataset" <- function(x, ..., drop=FALSE) {
x <- as.data.frame(x)
NextMethod("[", x)
}
"[[.ggobiDataset" <- function(x, ..., drop=FALSE) {
x <- as.data.frame(x)
NextMethod("[[", x)
}
"$.ggobiDataset" <- function(x, ..., drop=FALSE) {
x <- as.data.frame(x)
NextMethod("$", x)
}
> class(x)
[1]
2010 Jul 22
1
class
Hello,
### I created two classes "A" and "B". "A" is the superclass of "B".
setClass("A", representation(s1="numeric"),prototype=prototype(s1=8))
setClass("B",contains="A",representation(s2="character"),prototype=list(s2="hi"))
myA=new("A")
myB=new("B")
#### I created
2009 Feb 18
0
[LLVMdev] Parametric polymorphism
On Wed, Feb 18, 2009 at 12:32, DeLesley SpamBox
<delesley.spambox at googlemail.com> wrote:
>> I think the problem is deeper than that, in that LLVM has no official
>> concept of a subtype, so I don't see how the idea of polymorphism
>> could be defined in it.
>
> Parametric polymorphism is different from subtype polymorphism; you
> can have one without the
2005 May 23
2
Documentation of S3 and S4 classes, inheritance
I'd like to have a class A that computes a likelihood, and a subclass B
that computes the same likelihood by sometimes throws in an additional
term (B includes measurement error).
So B's likelihood needs to call A's, and then (sometimes) multiply by an
additional term.
It sounds as if, in the S3 scheme, NextMethod is supposed to do this:
like.A <- function(stuff) compute value
2019 Aug 07
1
NextMethod() and argument laziness
Hi all, I'd like to ask if the following behavior is a bug. To me it
certainly feels surprising, at the very least. In this example, I would
like to call NextMethod() from my `child` object, have `cols` be left
untouched, and then substitute(cols) in the parent method. It works when
you use a `parent` object (as expected), but I would have also expected to
get `mpg` back when calling it from
2009 Feb 18
2
[LLVMdev] Parametric polymorphism
> Why do you say that people who compile, e.g., functional languages
> would benefit from type variables in LLVM?
> I like the level the LLVM is at, and would prefer to deal with
> instantiating parametric polymorphism at a higher level.
I'm surprised you're happy with a non-polymorphic llvm. Does
Cayenne target llvm? Dependent types take polymorphism to new
heights -- but
2006 Jul 26
3
Polymorphic Association with Single Table Inheritance?
Hello,
is it possible to setup a model/table schema like this:
Groupable --> Membership <-- Group
^ ^
| |
User UserGroup
I tried the following but failed:
Groupable (table with ''type'' column)
has_many :memberships, :as => :groupable
has_many :groups, :through => :memberships
2018 Feb 20
2
How to modify dots and dispatch NextMethod
Hi all,
Not sure if this belongs to R-devel or R-package-devel. Anyways...
Suppose we have objects of class c("foo", "bar"), and there are two S3
methods c.foo, c.bar. In c.foo, I'm trying to modify the dots and
forward the dispatch using NextMethod without any success. This is
what I've tried so far:
c.foo <- function(..., recursive=FALSE) {
dots <-
2006 Apr 14
3
The object argument of NextMethod.
My question is when the object argument of NexthMethod be used?
In the following example, weather object argument is used will not
affects the result.
###
foo=function(x) {UseMethod("foo")}
foo.cls1=function(x)
{
x=x+1;class(x)<-"ncls"
NextMethod()
}
foo.ncls=function(x)
{
cat("ncls\n")
}
foo.cls2=function(x)
{
cat("cls2\n");print(x)
}
2008 Dec 28
1
[LLVMdev] Efficient implementation of closures?
On Sun, Dec 28, 2008 at 13:42, Jon Harrop <jon at ffconsultancy.com> wrote:
>
> Previous generation languages like OCaml compile this into a completely
> generic representation where polymorphism is handled at run-time.
> Consequently, even though the polymorphism is buried in the fold function
> (not visible at all in our "sum" function) it still incurs massive
>