2008/12/15 chromatic <chromatic@wgz.org>: > On Monday 15 December 2008 14:24:17 Rafael Garcia-Suarez wrote: > >> Sorry if I come late to this discussion, but what is the grand plan ? >> Surely a lone class keyword is not that useful ? The following has to >> be considered : >> >> * syntax extensions in the class{} block (for example default >> strictures, method keyword...) >> * class attributes (like inheritance, or final-ness à la final classes >> of Java, just to name some examples) >> * a 3rd idea that I haven't seen yet here... define defaults for >> method attributes ? (at BEGIN or CHECK time) Or interact with the >> compilation in one way or another > > I think class BLOCK by itself is useful (descriptive and simpler syntax for > compile-time package scoping and @ISA setting), but it's definitely a > required feature before even considering at least the first element of your > list. Certainly it has more value than the similarly small syntax change of > allowing 'method where 'sub' is today. The work on the method keyword was not only a way to introduce named parameters, but also aliasing and compile-time checking. (in a better way than prototypes) > Adding syntax extensions will be a much larger job, as it involves creating a > new type of block and defining certain syntactic constructs which are only > valid in the block. (I couldn't see any easy way to use a literal token in > the parser where currently you might use the WORD token, for example.) You do that in the tokeniser, not in the parser. Perl's tokeniser is scarily context-sensitive.Thread Previous | Thread Next