similar to: polymorphism + inheritance

Displaying 20 results from an estimated 700 matches similar to: "polymorphism + inheritance"

2006 Jan 12
10
uninitialized constant error
Hi Everyone, I''m a newbie to Rails, and I just finished going through the cookbook tutorial. I''m now trying to build my own application, and I''m trying to add more inputs to the edit view to modify data in other tables. Below is the controller code where I am having trouble. PartsLocation is another table (like Part) in the database, and that is the line where
2009 Apr 01
3
Nil being coerced to float
I was doing this: @line_items = LineItems.find_all_by_invoice_id(params[:id]) @payments = Payments.find_all_by_invoice_id(params[:id]) @total = @line_items.sum{ |item| item.cost } @payment_total = @payments.sum{ |payment| payment.value } @balance = @total - @payment_total But when no payments had been made it was coming up with an error when trying to sum nil, so I did
2009 Feb 19
0
[LLVMdev] Parametric polymorphism
On Wednesday 18 February 2009 23:36:27 DeLesley Hutchins wrote: > > 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
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 Mar 02
1
Fixture accessors broken for polymorphism, in need of redesign
Ticket 4052 (http://dev.rubyonrails.org/ticket/4052) just came through trac, which introduces the need for a better way to access fixtures. I believe the basic problem is the same as 3935 (http://dev.rubyonrails.org/ticket/3935) in that the accessor method which is constructed by the fixture call can''t infer the class name from the table name. The band-aid in 3935 was to allow you to
2010 Apr 25
1
method dispatching vs inheritance/polymorphism (re-post)
Hi, I'm having trouble seeing the added value over functions defined by setGeneric vis-a-vis methods defined by inheritance and polymorphism. setGeneric offers a 'clean' call to a generic function, ie. no need to call new(), so less typing to do for the user. But such explicit calls can also be avoided by functions like f <- function(x, y) new(Class = SomeClass, x=x, y=y). Then
2009 Feb 18
0
[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. On Wed, Feb 18, 2009 at 10:43 PM, DeLesley Hutchins <delesley.spambox at googlemail.com> wrote: >> I think many people were confused by this at first but an
2006 Mar 08
0
combining STI + polymorphism + rich self HABTM : how to ?
Hi all, I need to model simple typed polymorphic relations: ''John'' [''works_for''] ''Bill'' ''John'' [''speaks_for''] ''Microsoft'' ''Microsoft'' [''hold_shares_of''] ''Apple'' I''m having a hard time combining : - S.T.I.
2012 Mar 22
1
why doesn't .where() honor polymorphism?
I love the query interface (ActiveMethod::QueryMethods), but one thing has bugged me: why doesn''t it generate calls for polymorphic associations? For example: class MyModel < ActiveRecord::Base belongs_to :parent, :polymorphic => true end I would expect: MyModel.where(:parent => a) to be equivalent to: MyModel.where("my_models.parent_id = ? AND
2008 Nov 29
0
calendar with different types of event - polymorphism
Hi all, I have a calendar. The calendar has different kinds of events. Each event type has additional information so i think i need a new model for each new event type. eg: a game event has additional oponent and oponents colors info. Is this best solved via polymorphism where I create an eventable interface? Thanks Stijn --~--~---------~--~----~------------~-------~--~----~ You received this
2009 Feb 18
0
[LLVMdev] Parametric polymorphism
>> How difficult would it be to add such a capability to llvm? I was thinking >> of marking type variables like T as opaque types for the initial codegen, >> and then writing a custom pass that instantiates them to real types. >> However, I don't know if that would confuse or break other parts of the >> compiler infrastructure; parametric polymorphism is not
2012 Sep 18
0
S4, polymorphism, and parallelization
I am running Rmpi and MPICH2 to do parallelization in a Windows 7 machine. I am only using my PC's cores. Parallelization for standard R code works fine. For S4 code I am having the following problem: Let us say I have a class A and a subclasses B and C (both B and C "contains" A). I declared a method setGeneric( name = "superClassMethod", def = function(object)
2008 Sep 12
0
polymorphism with created_at and modified_at
Hi, I was wondering what happens, if I use polymorphism in combination with created_at and modified_at? Lets say I have 3 models, which all have the attributes created_at and modified_at, then how will they updated? Will changes in the child affect the "modified_at" of the parent? Will a "child.attribute_at()" yields the value of the child or the parent? Given the child,
2009 Aug 17
1
Polymorphism of predict
I can fit a line to a set of given points, e.g., > sm.fit <- smooth.spline(1:4,1:4) > lm.fit <- lm(y~x, data=list(x=1:4,y=1:4)) Now I have two objects representing the straight line y(x)=x, of class "smooth.spline" and "lm", respectively. And as could be expected in object orientation, both have a method "predict", which I could use for interpolating
2005 Dec 27
0
acts_as_tree, polymorphism and class loading problems
I have a tree (acts_as_tree) with nodes where each node is instances of different subclasses of Node. Each Node subclass knows how to point to another table/instance in order to accomplish extension by composition. This works good most of the time where I either loops over just the nodes without accessing the "external" data (the instance pointed to by Node subclass) or just
2012 Apr 05
0
Polymorphism, acts_as_relation gem and nested attributes
I have the following polymorphic association set up with acts_as_relation (https://github.com/hzamani/acts_as_relation) Model code: class Email < ActiveRecord::Base belongs_to :detail validates_presence_of :address end class Detail < ActiveRecord::Base acts_as_superclass has_many :emails accepts_nested_attributes_for :emails, allow_destroy: true
2006 Nov 04
0
[PATCH] #6040 STI and Polymorphism docs
Hi, I have had several emails from people thanking me for the following documention patch. http://dev.rubyonrails.org/ticket/6040 Any chance this could be commited so more people can find it? Peter
2007 Jul 16
0
100% polymorphism problem, hmm not so sure.
I have a problem to break down and implement. At first look it seems, as if it should be done in polymorphic way. I imagine it as having this "abstract" class model Thing and then many many many different concrete_thing_types. My doubt is though - I am not really able to tell now what and how many of those different concrete_thing_types there will be. There may be "hundreds"
2009 Feb 18
0
[LLVMdev] Parametric polymorphism
On 2009-02-18, at 14:53, DeLesley Hutchins wrote: > On 2009-02-18, at 08:06, Gordon Henriksen wrote: > >> Still, there are a large number of potential foibles here. For >> instance, passing an argument can require platform-specific >> contortions to conform to the platform ABI... > > Are those contortions done by the native code generator back-end, or > are
2009 Feb 18
0
[LLVMdev] Parametric polymorphism
On Wednesday 18 February 2009 21:27:21 DeLesley Hutchins wrote: > Try implementing a generic complex number class in Java, and watch the > two-order-of-magnitude drop in performance on scientific code. Amen. I haven't proven it with a working HLVM yet but I believe LLVM will make it possible (even easy?) to generate extremely performant code from heavily abstracted high-level source.