std.d.lexer: pre-voting review / discussion
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Sep 11 13:26:37 PDT 2013
On Wed, Sep 11, 2013 at 10:18:12PM +0200, Dicebot wrote:
> On Wednesday, 11 September 2013 at 20:08:44 UTC, H. S. Teoh wrote:
> >On Wed, Sep 11, 2013 at 10:04:20PM +0200, Dicebot wrote:
> >>On Wednesday, 11 September 2013 at 19:58:36 UTC, H. S. Teoh wrote:
> >>>I disagree. I think it's more readable to use a consistent prefix,
> >>>like kw... or kw_... (e.g. kw_int, kw_return, etc.), so that it's
> >>>clear you're referring to token types, not the actual keyword.
> >>
> >>Not unless you want to change the style guide and break existing
> >>Phobos code ;)
> >
> >How would that break Phobos code? Phobos code doesn't even use
> >std.d.lexer right now.
>
> Phobos code must conform its style guide. You can't change it
> without changing existing Phobos code that relies on it.
> Inconsistent style is worst of all options.
This doesn't violate Phobos style guidelines:
enum TokenType {
kwInt,
kwFloat,
kwDouble,
...
kwFunction,
kwScope,
... // etc.
}
The token representing a particular keyword is not the same thing as the
keyword itself. There's nothing that says "a D lexer must use token type
names that are derived from the D keywords it represents".
In fact, using a kw prefix for tokens representing keywords is *more*
consistent, because it doesn't require inserting _ for some enum values
but not for others.
I never said anything about changing Phobos style guidelines.
T
--
I think Debian's doing something wrong, `apt-get install pesticide',
doesn't seem to remove the bugs on my system! -- Mike Dresser
More information about the Digitalmars-d
mailing list