Re: [qlang] Q 7.0 character escape syntax (was: Re: [q-lang-users] ANN: Q 7.0 release candidate)
Brought to you by:
agraef
From: Andrew B. <an...@vo...> - 2006-02-16 23:18:23
|
On Wed, 15 Feb 2006 17:26:31 -0800, Albert Graef <Dr....@t-...> wrote: As an only-occasional user of Q, I'll weigh in with my $.02 here. > > I'm not sure what The Right Thing is in this case. So what should we do: > Keep the existing \ddd, \0ooo, \0xhhh notation and extend that with the > \(<int>) notation? Or rather jump on the C/Python/... bandwagon and > employ the widely used \ooo, \xhh, \uhhhh, \Uhhhhhhhh notation? (Note > that then I'd also have to slash the decimal escape syntax of pre-7.0 > releases, potentially breaking existing scripts in places where it might > not be easily noticed.) Any other proposals? Opinions? Is there a good reason to not make the "0" in \0xff just be optional? That gets a format that is consistent with the number literals, and a shorter--yet still clear--format for people like me who really hate senseless redundancy in a syntax. > > This convention was adopted from C (I think that the standard doesn't > actually specify this, but IIRC all C compilers I've used did it that > way). At least the newer versions of gcc generate a warning message in > the case of an unrecognized escape, though. I could easily do this in > the Q compiler as well, but unless you run the interpreter with the -w > option you won't notice the difference. ;-) OTOH, spitting out a syntax > error in this case seems a bit too harsh for my taste. What do others > think? I'd vote for making it an actuall error. Speaking as one who often has trouble remembering if the "bell" is '\b' or '\g' (somehow I _can_ remember that the bell character is ^g), I would like a quicker-than-running-it way to find out that one of them is an unrecognized escape. I can't think of any scenario where the fact that some characters can have an ignored '\' prepended to them can be used advantageously. And in the event that I think of one, I hope that someone around me cares enough to take my keyboard away and slap some sense into me. -andrew -- an...@vo... |