Deprecate C style declerations?
Don Clugston
dac at nospam.com.au
Sat Dec 23 21:36:12 PST 2006
Daniel Keep wrote:
> Hasan Aljudy wrote:
>>
>>
>> Don Clugston wrote:
>>>
>>> I'd also add:
>>> * some alternative to #line that doesn't waste the '#' symbol on such
>>> a rarely-used feature.
>>>
>>
>> I've always wondered if there's even anyone out there using this so
>> called "feature"?
>> Why would you want to alter the lexer's internal state of the current
>> line number?
>> Who even came up with the idea?
>>
>>> And there are probably a few more I've forgotten about.
>
> I use it!
>
> I'm currently working on a project that my supervisor wanted written in
> literate style. So I ported CWEB over to D, and it relies heavily on
> the use of #line. Basically, where code appears in the source document,
> and where it appears in the generated code often have little
> correlation, and without #line debugging would be next to impossible.
>
> Remember, just because you don't use a feature and think it's ugly,
> doesn't mean no one does.
>
> Let me put it this way: if #line is removed, I have to go back to C
> since I doubt my supervisor will let me use a language for which I'm
> stuck using an old compiler for. Hell, *I* wouldn't want to do that.
It's not about #line, just about the use of '#' for that single syntax
situation. (Even the suggested ##line would probably be acceptable).
> (As for C-style declarations, it means you can copy+paste a whole bunch
> of C declarations into D source. Yes they can be converted, but this is
> as simple as it gets. If it's no extra work for Walter, why remove it?)
Really, you can't just copy and paste. You need to change typedef to
alias, you need to change enums, etc.
It is just supporting a bad habit.
Reasons to remove it:
* Makes code harder to read -- it is currently possible to mix C-style
and D style declarations in a single block of code. That's disgusting.
* Complicates the compiler, and means that any D parsing tool also has
to parse C declarations.
* Probably restricts future language options, because of ambiguities
that it introduces.
> -- Daniel "you'll pry #line from my cold, dead hands"
More information about the Digitalmars-d
mailing list