std.d.lexer: pre-voting review / discussion

deadalnix deadalnix at gmail.com
Wed Sep 11 18:37:06 PDT 2013


On Wednesday, 11 September 2013 at 20:28:06 UTC, H. S. Teoh wrote:
> 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.
> 	}
>

Int, Function, Scope, Import are all valid identifiers.

random minimization like kw is really bad. It is even worse when 
it doesn't make anything sorter.


More information about the Digitalmars-d mailing list