On Mon, Apr 11, 2016 at 11:32:29PM +0200, Theo van den Heuvel wrote:
: Thanks Larry for the answer and the great language.
: It is quite ok for me to start alphabetically. I use the funny char
: to indicate a particular aspect shared by a bunch of subs operators
: and methods.
: So I tried:
: method term:<braveā¤> { "Mel G.".say }
: However, that gives me:
: Bogus postfix

Because it *is* a bogus postfix.  Nobody defined a postfix, so to the
parser, there's just random unicode gobbledygook after the dot.  Defining
a term only adds to the list of things the grammar recognizes when a
*term* is expected.  A term is not expected right after another term.
That's where a postfix or an infix is expected.  A term is expected
only at the beginning of an expression, or after an infix.  You can't
mix together terms and postfixes; their namespaces and usages entirely
disjunct.  Grammatical categories are very important to the extensibility
of the parser, so that's not something we're going to try to guess at.

On top of which, method names are off in the class's metaobject,
and don't participate in operator naming at all.  They have different
dispatchers: the operator is dispatched using the current set of nested
lexical scopes, while method calls are dispatched using the object's
set of parents and metaobjects.  This is how we keep OO from colliding
with functional programming.  You can make a method with any name you
like if you try hard enough, but that doesn't mean you can create random
associations with an operator or term throughout your program.  The scope
of the term you defined above will only be the lexical scope of the class
itself, and it won't get exported to the place you are wanting to use it,
even if you could use a term in postfix position, which you can't.

Sorry I can't write more clearly this early in the morning...  :)


Reply via email to