Declaration syntax

simendsjo simendsjo at gmail.com
Tue Jan 7 22:54:57 PST 2014


On Wednesday, 8 January 2014 at 00:35:19 UTC, Adam D. Ruppe wrote:
> On Wednesday, 8 January 2014 at 00:23:34 UTC, deed wrote:
>> 1. Are there technical reasons not to do it this way, like 
>> grammar/ambiguity, parsing time, etc.?
>
> I can't think of any, it is pretty simple to parse either way.
>
>> 2. Have others been thinking in same direction playing with 
>> converters or alternative front ends?
>
> I know there was one to make D look more like python a while 
> ago that was recently discussed again on the forum but I can't 
> remember what it was called right now.
>
>>   At this point the readability and overview would be improved 
>> IMO.
>
> I don't agree; I find that backwards and weird. Comes down to 
> what you're used to probably.
>
> Another option might be to put tabs in there so you write
>
> void    foo()
> int     bar()
>
> and so on so the names are vertically aligned.

+1 - I use spaces though.

The problem is that reading the code becomes difficult if you 
don't have nice formatting either way. The identifier is 
difficult to read, or the type is difficult to read. Formatting 
the code is the only way to make it easy to read.

If you're a vim user, look at vim-easy-align: 
https://github.com/junegunn/vim-easy-align
Other editors might have similar formatting rules.


More information about the Digitalmars-d mailing list