CHB doesn't list method compiled programmatically

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CHB doesn't list method compiled programmatically

hernanmd
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAKHmnHsyuAyLKh79p%3DTRrFNqYWo6w8k4yobDHynHNadw4PADHw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: CHB doesn't list method compiled programmatically

Mariano Martinez Peck-2


On Thu, May 14, 2020 at 11:07 PM Hernán Morales Durand <[hidden email]> wrote:
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?

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.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAOUkibGBUiVeR90xzhbwsH6xfFB3j9kS3DvFCXd9PUPadCLW9w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: CHB doesn't list method compiled programmatically

hernanmd


El vie., 15 may. 2020 a las 11:34, 'Mariano Martinez Peck' via VA Smalltalk (<[hidden email]>) escribió:


On Thu, May 14, 2020 at 11:07 PM Hernán Morales Durand <[hidden email]> wrote:
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?

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?
 

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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAOUkibGBUiVeR90xzhbwsH6xfFB3j9kS3DvFCXd9PUPadCLW9w%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAKHmnHs8crc_88grLxrZrJZb1-YFR9OhrQfDsjt9taF-Py54vQ%40mail.gmail.com.