Create type(class) dynamically
Hi, all! Is it possible in Pharo to create a type (class) dynamically? Not using special space for it, but create type by running method of another class. Thanks, Khrystyna. -- View this message in context: http://forum.world.st/Create-type-class-dynamically-tp4875651.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hi, You can create a class programatically using: ParentClass subclass: #ClassName instanceVariableNames: 'instVar1 instVar2' classVariableNames: '' category: 'APackage' Then you can add method using: ClassName compile: 'helloWorld ^''Hello world!''' for example. I don't know if this answer you question? Julien On 03/02/16 20:48, Khrystyna Mykhailiuk wrote:
Hi, all!
Is it possible in Pharo to create a type (class) dynamically? Not using special space for it, but create type by running method of another class.
Thanks, Khrystyna.
-- View this message in context: http://forum.world.st/Create-type-class-dynamically-tp4875651.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
I was a little confused about it. But now I understand. Thank you very much. 2016-02-03 22:09 GMT+02:00 Julien Delplanque [via Smalltalk] < ml-node+s1294792n4875655h45@n4.nabble.com>:
Hi,
You can create a class programatically using:
ParentClass subclass: #ClassName instanceVariableNames: 'instVar1 instVar2' classVariableNames: '' category: 'APackage'
Then you can add method using:
ClassName compile: 'helloWorld ^''Hello world!'''
for example.
I don't know if this answer you question?
Julien
On 03/02/16 20:48, Khrystyna Mykhailiuk wrote:
Hi, all!
Is it possible in Pharo to create a type (class) dynamically? Not using special space for it, but create type by running method of another class.
Thanks, Khrystyna.
-- View this message in context: http://forum.world.st/Create-type-class-dynamically-tp4875651.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
------------------------------ If you reply to this email, your message will be added to the discussion below: http://forum.world.st/Create-type-class-dynamically-tp4875651p4875655.html To unsubscribe from Create type(class) dynamically, click here <http://forum.world.st/template/NamlServlet.jtp?macro=unsubscribe_by_code&nod...> . NAML <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant...>
-- View this message in context: http://forum.world.st/Create-type-class-dynamically-tp4875651p4875657.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (2)
-
Julien Delplanque -
Khrystyna Mykhailiuk