Symbol>>#precedence is wrong about #_whatever and #_whatever:

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

Symbol>>#precedence is wrong about #_whatever and #_whatever:

Richard Sargent
Administrator
The #precedence method, used to identify the type of selector a Symbol is, incorrectly handles selectors beginning with an underscore.

A symbol is a binary selector if and only if every character meets the test defined in #abrIsSelectorCharacter (which suffers from being a misleading name).
A symbol is a unary selector if and only if every character meets the test [_a-zA-z][_a-zA-z0-9]*.
A symbol is a keyword selector if and only if every character meets the test [_a-zA-z][_a-zA-z0-9:]* and the last character is a colon.

--
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 post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Symbol>>#precedence is wrong about #_whatever and #_whatever:

John O'Keefe-3
Richard -

You are correct about the underscore. You will notice that the receiver of this method is assumed to be a valid Smalltalk selector, so it is sufficient to test only the first and last characters to determine unary, binary, keyword, or invalid. Case 57740 created.

John

On Friday, April 17, 2015 at 1:37:31 PM UTC-4, Richard Sargent wrote:
The #precedence method, used to identify the type of selector a Symbol is, incorrectly handles selectors beginning with an underscore.

A symbol is a binary selector if and only if every character meets the test defined in #abrIsSelectorCharacter (which suffers from being a misleading name).
A symbol is a unary selector if and only if every character meets the test [_a-zA-z][_a-zA-z0-9]*.
A symbol is a keyword selector if and only if every character meets the test [_a-zA-z][_a-zA-z0-9:]* and the last character is a colon.

--
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 post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Symbol>>#precedence is wrong about #_whatever and #_whatever:

Richard Sargent
Administrator
On Fri, Apr 17, 2015 at 1:20 PM, John O'Keefe <[hidden email]> wrote:
Richard -

You are correct about the underscore. You will notice that the receiver of this method is assumed to be a valid Smalltalk selector, so it is sufficient to test only the first and last characters to determine unary, binary, keyword, or invalid. Case 57740 created.

Thanks, John.
It would be nice if there were a correspondingly simple method (or methods) to determine whether a given Symbol was actually a valid selector. Especially so since these existing methods are in CLDT and don't prescribe how they must be used.
 

John

On Friday, April 17, 2015 at 1:37:31 PM UTC-4, Richard Sargent wrote:
The #precedence method, used to identify the type of selector a Symbol is, incorrectly handles selectors beginning with an underscore.

A symbol is a binary selector if and only if every character meets the test defined in #abrIsSelectorCharacter (which suffers from being a misleading name).
A symbol is a unary selector if and only if every character meets the test [_a-zA-z][_a-zA-z0-9]*.
A symbol is a keyword selector if and only if every character meets the test [_a-zA-z][_a-zA-z0-9:]* and the last character is a colon.

And I guess I should elaborate this last one with the condition "and there are no sequences of multiple colons".
 

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/va-smalltalk/IirYjnWHOt4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.