The #compile: selector

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

The #compile: selector

mbratch
When using the #compile: selector to dynamically create a selector, is there a way (e.g., a pragma) to specify the category for the dynamic selector in a way that Pharo will see it? I tried, for example:

s := String new writeStream.
s nextPutAll: 'foo' ; cr ; nextPutAll: '  <category: ''accessor''>' ; cr ; nextPutAll: '  ^fooVar' ; cr.
Foo compile: s contents.

Which created the following selector just fine:

foo
    <categor: 'accessor'>
    ^ fooVar

But Pharo considers it uncategorized. I'm just wondering if it's possible.

Thanks
Mark

Reply | Threaded
Open this post in threaded view
|

Re: The #compile: selector

Henrik Nergaard

SomeClass compile: 'foo ^ ''foo''' classified: #accessor

 

Best regards,

Henrik

 

From: Pharo-users [mailto:[hidden email]] On Behalf Of Mark Bratcher
Sent: Wednesday, June 15, 2016 8:06 PM
To: Any question about pharo is welcome <[hidden email]>
Subject: [Pharo-users] The #compile: selector

 

When using the #compile: selector to dynamically create a selector, is there a way (e.g., a pragma) to specify the category for the dynamic selector in a way that Pharo will see it? I tried, for example:

 

s := String new writeStream.
s nextPutAll: 'foo' ; cr ; nextPutAll: '  <category: ''accessor''>' ; cr ; nextPutAll: '  ^fooVar' ; cr.

Foo compile: s contents.

 

Which created the following selector just fine:

 

foo
    <categor: 'accessor'>

    ^ fooVar

 

But Pharo considers it uncategorized. I'm just wondering if it's possible.

 

Thanks

Mark

 

Reply | Threaded
Open this post in threaded view
|

Re: The #compile: selector

mbratch

Brilliant. Thank you!

Sent from TypeApp

On Jun 15, 2016, at 2:28 PM, Henrik Nergaard <[hidden email]> wrote:

SomeClass compile: 'foo ^ ''foo''' classified: #accessor

 

Best regards,

Henrik

 

From: Pharo-users [mailto:[hidden email]] On Behalf Of Mark Bratcher
Sent: Wednesday, June 15, 2016 8:06 PM
To: Any question about pharo is welcome <[hidden email]>
Subject: [Pharo-users] The #compile: selector

 

When using the #compile: selector to dynamically create a selector, is there a way (e.g., a pragma) to specify the category for the dynamic selector in a way that Pharo will see it? I tried, for example:

 

s := String new writeStream.
s nextPutAll: 'foo' ; cr ; nextPutAll: '  <category: ''accessor''>' ; cr ; nextPutAll: '  ^fooVar' ; cr.

Foo compile: s contents.

 

Which created the following selector just fine:

 

foo
    <categor: 'accessor'>

    ^ fooVar

 

But Pharo considers it uncategorized. I'm just wondering if it's possible.

 

Thanks

Mark