Backend nearly entirely converted to D

Stanislav Blinov stanislav.blinov at gmail.com
Thu Nov 8 18:15:55 UTC 2018


On Thursday, 8 November 2018 at 17:50:20 UTC, welkam wrote:
> On Wednesday, 7 November 2018 at 22:08:36 UTC, H. S. Teoh wrote:

> Now for all of you who think that one letter variables are ok 
> here is exercise. Go and open src/dmd/func.d with your favorite 
> code editor. Find function FuncDeclaration resolveFuncCall(). 
> Its around 170 LOC long. Now find all uses of variable Dsymbol 
> s. Did you found them all? Are you sure? Ok now do the same for 
> variable loc. See the difference?

If we were to look for an s of a specific type, it's not just the 
editor we would need, now would we?

>> Java-style verbosity IMO makes code *harder* to read because 
>> the verbosity gets > in your face, crowding out the more 
>> interesting (and important) larger picture of code structure.
>
> What editor do you use?
> Here is the worst example to prove my point but its still 
> sufficient. All editors worth your time highlights the same 
> text when selected and here is example of one letter variable.
> https://imgur.com/a/jjxCdmh
> and tree letter variable
> https://imgur.com/a/xOqbkmn

One keystroke (well ok, two keys because it's *) ;)
https://dl.dropbox.com/s/mifou0ervwspx5i/vimhl.png

> where is all that crowding and loss of large picture you speak 
> of? Its the opposite. Code structure is more clear with longer 
> variable names than one letter.

I don't think H.S. meant one letter vs. three. Java tends to be 
obtusely verbose. Wear down your fingers/eyes kind of verbose.

>> As Walter said in his recent talk, the length of variable 
>> names (or identifiers in general, really) should roughly 
>> correspond to their scope
>
> At best this is argument form authority. You said how thing 
> should be not why. For argument sake imagine situation where 
> you need to expand function. By your proposed rules you should 
> rename local variables to longer names. Thats ridiculous. Yes I 
> watched that presentation and fully disagree with Walter and 
> know for sure he doesnt have sound argument to support his 
> position.

IMHO, one/two letters are fine so long as the variable's scope 
spans at most two pages. If scope is larger, name should be 
longer.


More information about the Digitalmars-d-announce mailing list