Re: [q-lang-users] New stuff in cvs: multichar ops, views
Brought to you by:
agraef
From: Rob H. <hub...@gm...> - 2007-05-31 08:40:11
|
Hello Albert, On 31/05/07, Albert Graef <Dr....@t-...> wrote: > John Cowan wrote: > > I'm happy with that -- I assume that "--" is distinct from "- -" > > where the latter is unary minus? > > Yes, sure. The unparser now also makes sure that spaces are inserted > between adjacent binary and unary symbols. > > But note that this was just an example, (--) is not in the standard > library. So unless you define (--) yourself you can still write 5--3 and > get the expected result, 8. :) I'm very happy to see multi-character operators introduced. (Does Q also allow Unicode operators?) I presume that tokens will be delimited according to which set their constituent characters belong to: 'alphanumeric' or 'other' (although an 'alphanumeric' token must begin with an alphabetical character, of course). Is white-space a special case, i.e. a third class of character? Which characters are in the 'other' set for operators - are any (such as quote and parentheses) excluded? Does this also mean that multi-other-character function names are also supported? That is, can I now define a non-operator function called '--'? (I suppose that includes the secondary question: would 'other' characters count as lower case?) It seems that now, introducing a new symbol will affect the way that code is parsed. This is something I find a little worrying. Would it be better to have, e.g. '--' always as an atomic token, producing a normal form unless '--' is defined? That is, would is be better to break backwards compatibility? Or would that be too painful? Is the protection offered by the module system thought to be enough? [Can of worms! Sorry.] Thanks, Rob. |