Re: [fpc-pascal] Adding method dynamically to a class

2012-06-22 Thread Jorge Aldo G. de F. Junior
Use event properties (Properties to a procedural type) Adding completely free methods to a class makes no sense. By free i mean a method that has no clear signature (parameters and result type) because calling them will be a nightmare (You will have to do the compiler work and build your own

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-21 Thread ik
On Wed, Jun 20, 2012 at 2:15 PM, Inoussa OUEDRAOGO inouss...@gmail.comwrote: Think of a plug-able system. I have an engine, and code to execute. Instead of compile everything to an ELF/PE, I place code on dynamic shard library, and load it on run time when needed. The idea is that the

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread ik
On Wed, Jun 20, 2012 at 8:33 AM, LacaK la...@zoznam.sk wrote: ** Class helpers would not help ? http://wiki.freepascal.org/Helper_types They can, but there is a protocol that I'm trying to create that provides me information what to execute (out of white list). The thing is, that the first

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread michael . vancanneyt
On Wed, 20 Jun 2012, ik wrote: On Wed, Jun 20, 2012 at 8:33 AM, LacaK la...@zoznam.sk wrote: ** Class helpers would not help ? http://wiki.freepascal.org/Helper_types They can, but there is a protocol that I'm trying to create that provides me information what to execute (out of white

RE : [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread Ludo Brands
They can, but there is a protocol that I'm trying to create that provides me information what to execute (out of white list). The thing is, that the first request maps the methods to be used, and there could be 2 or 200. To implement 200 methods that might be used is not a good idea imho, but

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread ik
On Wed, Jun 20, 2012 at 10:20 AM, michael.vancann...@wisa.be wrote: On Wed, 20 Jun 2012, ik wrote: On Wed, Jun 20, 2012 at 8:33 AM, LacaK la...@zoznam.sk wrote: ** Class helpers would not help ? http://wiki.freepascal.org/**Helper_typeshttp://wiki.freepascal.org/Helper_types They

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread kyan
I suggest that you implement this using interfaces. You place the interface declaration in a common file, use the interfaces from the main exe but implement them in separate dlls. This gives you all the flexibility you want, e.g. group your methods into bundles and place them on different

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread michael . vancanneyt
On Wed, 20 Jun 2012, ik wrote: On Wed, Jun 20, 2012 at 10:20 AM, michael.vancann...@wisa.be wrote: On Wed, 20 Jun 2012, ik wrote: On Wed, Jun 20, 2012 at 8:33 AM, LacaK la...@zoznam.sk wrote: ** Class helpers would not help ?

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread Marco van de Voort
In our previous episode, kyan said: I suggest that you implement this using interfaces. You place the interface declaration in a common file, use the interfaces from the main exe but implement them in separate dlls. Or maybe go a step further, and use IDispatch that passes through unknown

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread Inoussa OUEDRAOGO
Think of a plug-able system. I have an engine, and code to execute. Instead of compile everything to an ELF/PE, I place code on dynamic shard library, and load it on run time when needed. The idea is that the engine will not be rewritten for every new request (that comes often), because

[fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread ik
Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type TTest = class procedure Foo; end; And I have also: procedure Bar; ... end; Is there a way to make at some point of my code

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread michael . vancanneyt
On Tue, 19 Jun 2012, ik wrote: Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type TTest = class procedure Foo; end; And I have also: procedure Bar; ... end; Is there a way

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread Jonas Maebe
michael.vancanneyt wrote on Tue, 19 Jun 2012: As far as I know there is no language structure for this, unless the objective C classes support offers this. You can indeed do that in Objective-C/Pascal, but a) that's not via a language construct, but by directly interacting with the

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread Mattias Gaertner
ik ido...@gmail.com hat am 19. Juni 2012 um 14:22 geschrieben: Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type TTest = class procedure Foo; end; And I

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread ik
On Tue, Jun 19, 2012 at 4:13 PM, Mattias Gaertner nc-gaert...@netcologne.de wrote: ** ik ido...@gmail.com hat am 19. Juni 2012 um 14:22 geschrieben: Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread JC Chu
Depending on what you’re actually trying to do, you may consider implementing your own invokable variant type. I found a tutorial at http://alex.ciobanu.org/?p=152. Basically, instances will be wrapped in a TVarData-compatible record, and your custom TInvokeableVariantType-derived class will

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread LacaK
Class helpers would not help ? http://wiki.freepascal.org/Helper_types -Laco. Hello, Is there a way to tell in run-time that a specific function/procedure should belong to a class ? For example, let's say I have the following class: Type