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
SomeClass compile: 'foo ^ ''foo''' classified: #accessor Best regards, Henrik From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Mark Bratcher Sent: Wednesday, June 15, 2016 8:06 PM To: Any question about pharo is welcome <pharo-users@lists.pharo.org> 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
Brilliant. Thank you! Sent from TypeApp On Jun 15, 2016, 2:28 PM, at 2:28 PM, Henrik Nergaard <henrik.nergaard@uia.no> wrote:
SomeClass compile: 'foo ^ ''foo''' classified: #accessor
Best regards, Henrik
From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Mark Bratcher Sent: Wednesday, June 15, 2016 8:06 PM To: Any question about pharo is welcome <pharo-users@lists.pharo.org> 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
participants (2)
-
Henrik Nergaard -
Mark Bratcher