Re: Calling method by name.

2011-02-08 Thread Jacob Carlborg
On 2011-02-08 05:54, Robert Jacques wrote: On Sat, 05 Feb 2011 13:14:42 -0500, Jacob Carlborg d...@me.com wrote: On 2011-02-04 05:07, Jonathan M Davis wrote: [snip] Most of the good examples of runtime reflection that I'm aware of require user- defined attributes. But there are libraries in

Re: Calling method by name.

2011-02-07 Thread Robert Jacques
On Sat, 05 Feb 2011 13:14:42 -0500, Jacob Carlborg d...@me.com wrote: On 2011-02-04 05:07, Jonathan M Davis wrote: [snip] Most of the good examples of runtime reflection that I'm aware of require user- defined attributes. But there are libraries in Java (and presumably C#) that do stuff

Re: Calling method by name.

2011-02-06 Thread Jacob Carlborg
runtime reflection. Then you can query the database, also using runtime reflection: Post.find_by_name_and_body(some title, the body) Will find the first row where title and body matches the given values. FWIW, python example of Calling method by name (using no exotic feature): class C: def

Re: Calling method by name.

2011-02-05 Thread Jacob Carlborg
On 2011-02-04 05:07, Jonathan M Davis wrote: On Thursday 03 February 2011 19:29:15 Robert Jacques wrote: On Thu, 03 Feb 2011 08:49:54 -0500, Jacob Carlborgd...@me.com wrote: On 2011-02-03 05:52, Robert Jacques wrote: On Wed, 02 Feb 2011 12:55:37 -0500, %uf...@jhgjhb.com wrote: I know is

Re: Calling method by name.

2011-02-05 Thread Jacob Carlborg
On 2011-02-04 17:17, Adam Ruppe wrote: Jacob Carlborg wrote: The class Post maps to the database table posts, no configuration is necessary. Then you can use the column names in the table as fields to set and get data, like this: post = Post.new post.title = some title post.body = the body

Re: Calling method by name.

2011-02-04 Thread Jacob Carlborg
On 2011-02-04 04:29, Robert Jacques wrote: On Thu, 03 Feb 2011 08:49:54 -0500, Jacob Carlborg d...@me.com wrote: On 2011-02-03 05:52, Robert Jacques wrote: On Wed, 02 Feb 2011 12:55:37 -0500, %u f...@jhgjhb.com wrote: I know is possible to create an object from its name. It's possible to

Re: Calling method by name.

2011-02-04 Thread Adam Ruppe
Jacob Carlborg wrote: The class Post maps to the database table posts, no configuration is necessary. Then you can use the column names in the table as fields to set and get data, like this: post = Post.new post.title = some title post.body = the body post.save # will update the database

Re: Calling method by name.

2011-02-04 Thread spir
method by name (using no exotic feature): class C: def __init__(self, x): self.x = x def write (self, thing): print %s == %s ? %s \ %(self.x,thing, self.x==thing) def runMethodWithArgs (object, name, *args): method = getattr(object, name) method(*args) c

Re: Calling method by name.

2011-02-03 Thread Jacob Carlborg
On 2011-02-02 21:11, Robert Clipsham wrote: On 02/02/11 20:00, Jacob Carlborg wrote: On 2011-02-02 20:42, Robert Clipsham wrote: On 02/02/11 17:55, %u wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at

Re: Calling method by name.

2011-02-03 Thread Jacob Carlborg
On 2011-02-02 22:51, Stanislav Blinov wrote: On 02/02/2011 11:11 PM, Robert Clipsham wrote: On 02/02/11 20:00, Jacob Carlborg wrote: On 2011-02-02 20:42, Robert Clipsham wrote: On 02/02/11 17:55, %u wrote: I know is possible to create an object from its name. It's possible to call a method

Re: Calling method by name.

2011-02-03 Thread Stanislav Blinov
03.02.2011 12:54, Jacob Carlborg пишет: On 2011-02-02 22:51, Stanislav Blinov wrote: AFAIK, D2's TypeInfo and friends do have an interface for runtime reflection (methods offTi() and getMembers()), though a quick glance shows they're not implemented, i.e. return null all the time. I think

Re: Calling method by name.

2011-02-03 Thread Jacob Carlborg
On 2011-02-03 05:52, Robert Jacques wrote: On Wed, 02 Feb 2011 12:55:37 -0500, %u f...@jhgjhb.com wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at runtime? Would something like the following be possible?

Re: Calling method by name.

2011-02-03 Thread Robert Jacques
On Thu, 03 Feb 2011 08:49:54 -0500, Jacob Carlborg d...@me.com wrote: On 2011-02-03 05:52, Robert Jacques wrote: On Wed, 02 Feb 2011 12:55:37 -0500, %u f...@jhgjhb.com wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is

Re: Calling method by name.

2011-02-03 Thread Jonathan M Davis
On Thursday 03 February 2011 19:29:15 Robert Jacques wrote: On Thu, 03 Feb 2011 08:49:54 -0500, Jacob Carlborg d...@me.com wrote: On 2011-02-03 05:52, Robert Jacques wrote: On Wed, 02 Feb 2011 12:55:37 -0500, %u f...@jhgjhb.com wrote: I know is possible to create an object from its name.

Re: Calling method by name.

2011-02-03 Thread Andrew Wiley
On Thu, Feb 3, 2011 at 10:07 PM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Thursday 03 February 2011 19:29:15 Robert Jacques wrote: On Thu, 03 Feb 2011 08:49:54 -0500, Jacob Carlborg d...@me.com wrote: On 2011-02-03 05:52, Robert Jacques wrote: On Wed, 02 Feb 2011 12:55:37 -0500, %u

Re: Calling method by name.

2011-02-03 Thread Jonathan M Davis
On Thursday 03 February 2011 20:23:25 Andrew Wiley wrote: On Thu, Feb 3, 2011 at 10:07 PM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Thursday 03 February 2011 19:29:15 Robert Jacques wrote: On Thu, 03 Feb 2011 08:49:54 -0500, Jacob Carlborg d...@me.com wrote: On 2011-02-03 05:52,

Calling method by name.

2011-02-02 Thread %u
I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at runtime? Would something like the following be possible? string classname, methodname; // Ask the user for class and method. auto obj = Object.factory(classname);

Re: Calling method by name.

2011-02-02 Thread Robert Clipsham
On 02/02/11 17:55, %u wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at runtime? Would something like the following be possible? string classname, methodname; // Ask the user for class and method. auto obj

Re: Calling method by name.

2011-02-02 Thread Jacob Carlborg
On 2011-02-02 20:42, Robert Clipsham wrote: On 02/02/11 17:55, %u wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at runtime? Would something like the following be possible? string classname, methodname; //

Re: Calling method by name.

2011-02-02 Thread Robert Clipsham
On 02/02/11 20:00, Jacob Carlborg wrote: On 2011-02-02 20:42, Robert Clipsham wrote: On 02/02/11 17:55, %u wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at runtime? Would something like the following be

Re: Calling method by name.

2011-02-02 Thread Stanislav Blinov
On 02/02/2011 11:11 PM, Robert Clipsham wrote: On 02/02/11 20:00, Jacob Carlborg wrote: On 2011-02-02 20:42, Robert Clipsham wrote: On 02/02/11 17:55, %u wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at

Re: Calling method by name.

2011-02-02 Thread Andrej Mitrovic
On 2/2/11, Stanislav Blinov stanislav.bli...@gmail.com wrote: AFAIK, D2's TypeInfo and friends do have an interface for runtime reflection (methods offTi() and getMembers()), though a quick glance shows they're not implemented, i.e. return null all the time. Talk about posting this after I've

Re: Calling method by name.

2011-02-02 Thread Robert Jacques
On Wed, 02 Feb 2011 12:55:37 -0500, %u f...@jhgjhb.com wrote: I know is possible to create an object from its name. It's possible to call a method from that object if the name is only known at runtime? Would something like the following be possible? string classname, methodname; // Ask the