From: Tobias DiPasquale Date: 2001-08-01T03:11:50+09:00 Subject: [ruby-talk:18904] Re: Digits in method names Indeed you are correct. Most parsers in use are one-character look-ahead due to speed constraints. I forgot to mention that. My bad :( brucedickey wrote: > > -----Original Message----- > > From: Tobias DiPasquale [mailto:anany@ece.villanova.edu] > > Sent: Tuesday, July 31, 2001 11:14 AM > > To: ruby-talk@ruby-lang.org > > Subject: [ruby-talk:18901] Re: Digits in method names > > > > > > Read about context-free grammars and the theory of compiler > > design and you > > will know why. Basically, it's because the interpreter sees a > > number, and > > thinks that a numeric sequence follows, NOT a method or > > object instance > > name. Allowing numbers to start method/object names would be > > a task equal > > to a Turing machine, whereas a compiler/interpreter is a CFG. > > Yes, in pure theory -- the theory of certain types of parsers, that is. > However, in practice identifiers are usually limited to a fixed number of > significant characters and therefore it is possible to distinguish a number > from an identifier within that number of characters. Most mainstream parsers > are limited to one character of look-ahead (if any) (are LALR, LL(1), etc), > and that is the reason for the restriction. > > > > > Aleksei Guzev wrote: > > > > > Why not allow starting method names with digits? > > > This would allow measurement units support. I.e. 10cm == > > 100mm and much > > > more. > >