so:
> Like many else, i also have encountered the C case in the report.
> It was always my own fault forgetting operator precedence and still using
> it without parentheses.
> Would that make the well defined operator precedence a bad thing?
Exactly. Compilers and languages may be improved, whi
So in such cases I'd like D to require parentheses, so this becomes a
syntax error:
Foo!int* x;
And you need to write:
Foo!(int*)
or:
Foo!(int)*
This avoids a possible source of confusion.
The relative enhancement request:
http://d.puremagic.com/issues/show_bug.cgi?id=5286
Bye,
bearophile
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_ programmer
On 11/30/2010 01:54 AM, critic wrote:
It has been many times said that the template T!X syntax optimization is a very
lousy hack with problems. In their arrogance, the authors completely ignore all
criticism.
Every optimization comes with problems. What problems does the T!X
optimization hav
On Tue, 30 Nov 2010 06:03:47 +0800
KennyTM~ 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)
>
>
bearophile Wrote:
> D has removed some cases of bug-prone C syntax, like:
>
> int main() {
> int* ptr1, ptr2;
> return 0;
> }
>
>
> But D needs to avoid introducing new ones. In D2 there is a shortcut to
> instantiate templates, but it must not cause ambiguity for the eyes of the
> pr
On Nov 30, 10 05:20, bearophile wrote:
D has removed some cases of bug-prone C syntax, like:
int main() {
int* ptr1, ptr2;
return 0;
}
But D needs to avoid introducing new ones. In D2 there is a shortcut to
instantiate templates, but it must not cause ambiguity for the eyes of the
D has removed some cases of bug-prone C syntax, like:
int main() {
int* ptr1, ptr2;
return 0;
}
But D needs to avoid introducing new ones. In D2 there is a shortcut to
instantiate templates, but it must not cause ambiguity for the eyes of the
programmer that reads the code (the point i