All,
I just hit a case where I needed to return the caret character "^" as a Symbol. However simply doing something like method ^ #^. doesn't work. Even inspecting the symbol itself #^ inspect. doesn't work. "Quoting" the caret works fine: method ^ #'^'. So I'm wondering whether #^ (w/o) quoting is considered to be legal syntax and it's a parser "bug" or whether it's invalid by definition CU, Udo |
Hi Udo,
#^ is invalid by definition. #'^' is the right way to write it. The definition is that # can be followed by a message selector (including binary selectors such as -), or by a quoted string, or by an opening parenthesis (array literal). Regards, Thierry Le 27/09/2015 12:27, Udo Schneider a écrit : > All, > > I just hit a case where I needed to return the caret character "^" as a > Symbol. However simply doing something like > > method > ^ #^. > > doesn't work. Even inspecting the symbol itself > > #^ inspect. > > doesn't work. "Quoting" the caret works fine: > > method > ^ #'^'. > > So I'm wondering whether #^ (w/o) quoting is considered to be legal > syntax and it's a parser "bug" or whether it's invalid by definition > > CU, > > Udo > > > |
Interesting though that
#'a' printIt--> #a but #'^' printIt--> #'^' cheers -ben On Sun, Sep 27, 2015 at 7:05 PM, Thierry Goubier <[hidden email]> wrote: > Hi Udo, > > #^ is invalid by definition. #'^' is the right way to write it. > > The definition is that # can be followed by a message selector (including > binary selectors such as -), or by a quoted string, or by an opening > parenthesis (array literal). > > Regards, > > Thierry > > > Le 27/09/2015 12:27, Udo Schneider a écrit : >> >> All, >> >> I just hit a case where I needed to return the caret character "^" as a >> Symbol. However simply doing something like >> >> method >> ^ #^. >> >> doesn't work. Even inspecting the symbol itself >> >> #^ inspect. >> >> doesn't work. "Quoting" the caret works fine: >> >> method >> ^ #'^'. >> >> So I'm wondering whether #^ (w/o) quoting is considered to be legal >> syntax and it's a parser "bug" or whether it's invalid by definition >> >> CU, >> >> Udo >> >> >> > > |
Le 28/09/2015 03:58, Ben Coman a écrit :
> Interesting though that > > #'a' printIt--> #a > > but > > #'^' printIt--> #'^' If the symbol contains characters which would not make it a valid symbol, enclose with quotes. Note that #'' is possible. Thierry > > cheers -ben > > On Sun, Sep 27, 2015 at 7:05 PM, Thierry Goubier > <[hidden email]> wrote: >> Hi Udo, >> >> #^ is invalid by definition. #'^' is the right way to write it. >> >> The definition is that # can be followed by a message selector (including >> binary selectors such as -), or by a quoted string, or by an opening >> parenthesis (array literal). >> >> Regards, >> >> Thierry >> >> >> Le 27/09/2015 12:27, Udo Schneider a écrit : >>> >>> All, >>> >>> I just hit a case where I needed to return the caret character "^" as a >>> Symbol. However simply doing something like >>> >>> method >>> ^ #^. >>> >>> doesn't work. Even inspecting the symbol itself >>> >>> #^ inspect. >>> >>> doesn't work. "Quoting" the caret works fine: >>> >>> method >>> ^ #'^'. >>> >>> So I'm wondering whether #^ (w/o) quoting is considered to be legal >>> syntax and it's a parser "bug" or whether it's invalid by definition >>> >>> CU, >>> >>> Udo >>> >>> >>> >> >> > > |
In reply to this post by Thierry Goubier
> The definition is that # can be followed by a message selector
> (including binary selectors such as -), or by a quoted string, or by an > opening parenthesis (array literal). Thanks for the info. Thinking in terms of the parser tokens makes things clear now. Thanks, Udo On 27/09/15 13:05, Thierry Goubier wrote: > Hi Udo, > > #^ is invalid by definition. #'^' is the right way to write it. > > The definition is that # can be followed by a message selector > (including binary selectors such as -), or by a quoted string, or by an > opening parenthesis (array literal). > > Regards, > > Thierry > > Le 27/09/2015 12:27, Udo Schneider a écrit : >> All, >> >> I just hit a case where I needed to return the caret character "^" as a >> Symbol. However simply doing something like >> >> method >> ^ #^. >> >> doesn't work. Even inspecting the symbol itself >> >> #^ inspect. >> >> doesn't work. "Quoting" the caret works fine: >> >> method >> ^ #'^'. >> >> So I'm wondering whether #^ (w/o) quoting is considered to be legal >> syntax and it's a parser "bug" or whether it's invalid by definition >> >> CU, >> >> Udo >> >> >> > > > |
Free forum by Nabble | Edit this page |