Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: James Masters
RE: Multiple Constructors? [ reply ]  
2008-10-03 17:42
Thanks Jason. Please do update this forum (I'm monitoring it now) if/when this feature and general method overloading is available. This is a must-have for what I'm doing.

Thanks again,
-James

By: Jason Roelofs
RE: Multiple Constructors? [ reply ]  
2008-10-03 17:39
Hmm, no real update right now. Your best bet is to pick just one constructor and use it.

I plan on playing around with some ideas about a constructor wrapper that dispatches according to the parameters passed in, so I guess you could give that a try.

We definitely need to start looking into adding general method overloading to Rice, and from that multiple constructors will also be implemented.

By: James Masters
RE: Multiple Constructors? [ reply ]  
2008-10-03 17:03
Does anyone have an update to this? I'm just starting to use Rice and I've already run into this problem. Any native way to do this or at least a clever work-around?

By: Jason Roelofs
RE: Multiple Constructors? [ reply ]  
2008-06-26 23:09
Correct, Rice currently only supports one constructor for a class. I'm not sure what the best way of getting around this limitation is. Paul might have an idea, but for now you'll have to either just use one constructor or try a wrapper method.

By: Gordon Rios
Multiple Constructors? [ reply ]  
2008-06-26 22:34
I think this was touched on in another post but I can't find it -- does Rice not like multiple constructors in Data_Type?

For example:

Data_Type<HyperClient> rb_cHyperClient =
define_class<HyperClient>("HyperClient")
.define_constructor(Constructor<HyperClient, Rice::String, Rice::String >())
.define_constructor(Constructor<HyperClient, Rice::String, Rice::String, Rice::String>())
// define_methods ...

will compile but at run time the extension only recognizes the two string signature or whichever one is defined first.