Tidy template instantiation syntax

spir denis.spir at gmail.com
Tue Nov 30 03:45:15 PST 2010


On Tue, 30 Nov 2010 06:03:47 +0800
KennyTM~ <kennytm at gmail.com> wrote:

> -1. The programmer should be able to look up the operator precedence 
> when they encounter code like this. This proposal is like requiring
> 
>     *p+1
> 
> to become a syntax error because it could be one of
> 
>     (*p)+1
>     *(p+1)
> 
> I don't believe this is a common and hard-to-catch source of bugs, so 
> the compiler doesn't need to be a style-checker here.

I do not agree with this position. I actually find *p+1 undecidable. Would like the compiler enforcing proper parenthesizing in all such ambiguous cases.
By the way, there has been a study about operator precedence in C-like languages. It shows very common errors by _experienced_ programmers even in plain expressions (no incolving special cases like pointer ref/deref). This study also shows the proportion of lines of codes involving more that one operator is tiny. An implicit conclusion, for me, is to remove operator precedence. I do not ask for this, indeed, in D, just comment.


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list