CHB doesn't list method compiled programmatically

23 views
Skip to first unread message

Hernán Morales Durand

unread,
May 14, 2020, 10:07:39 PM5/14/20
to va-sma...@googlegroups.com
Hello all,

I'm running VA Smalltalk 9.1 x64 on Windows 8.1.

I could programmatically compile code and add it to a method dictionary, however the Class Hierarchy Browser doesn't list the method, although it's there accessing through the #sourceString method.

| source method |

targetClass := Object.
source := 'm0 ^ 42' .
method := targetClass compiler 
	compile: source
	inClass: targetClass 
	ifFail: [: err | self errorMessage: err ].
method setSource: source.
targetClass addCompiledMethod: method.
(Object >> #m0) sourceString.

Did I miss something?
Cheers,

Hernán

Mariano Martinez Peck

unread,
May 15, 2020, 10:34:18 AM5/15/20
to VA Smalltalk
I would use Grease (under "Platform Portability" configuration map):

| source method |

targetClass := Object.

source := 'm0 ^ 42' .

GRPlatform current 

compile: source

into: targetClass

classified: #foo


Or.... use the method that Grease uses internally:

| source method |

targetClass := Object.

source := 'm1 ^ 42' .

targetClass

compile: source

notifying: Transcript

ifNewAddTo: targetClass controller

categorizeIn: (Array with: #foo asString)



Does this help?
 
--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

Hernán Morales Durand

unread,
May 15, 2020, 12:49:07 PM5/15/20
to va-sma...@googlegroups.com
Thank you Mariano! I got it to work :)

Cheers,

Hernán

 
--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAOUkibGBUiVeR90xzhbwsH6xfFB3j9kS3DvFCXd9PUPadCLW9w%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages