On 10/23/14 3:22 PM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net
wrote:
On Thursday, 23 October 2014 at 18:57:33 UTC, Ali Çehreli wrote:
On 10/22/2014 11:37 PM, Jonathan M Davis wrote:
x = x;
which is so obviously wrong that I don't know how much of
anyone could
make that mistake. But
Oh OK here it is:
http://dlang.org/deprecate.html#Variable%20shadowing%20inside%20functions
But it says it is an error to use the feature by 2.061 and I'm using 2.066!
Doesn't the scope of that deprecation cover struct members too? In
general it should be like variables in inner scopes should
On Thursday, October 23, 2014 11:47:04 Shriramana Sharma via
Digitalmars-d-learn wrote:
Oh OK here it is:
http://dlang.org/deprecate.html#Variable%20shadowing%20inside%20functions
But it says it is an error to use the feature by 2.061 and
I'm using
2.066!
Doesn't the scope of that
Jonathan M Davis:
Questions like this have come up and been discussed before, but
using the same parameter names as member variable names for
constructors is such a common practice that there would be
quite a bit of screaming if we didn't allow it.
I'm willing to hear them scream. D should
On 10/23/14 1:03 AM, Shriramana Sharma via Digitalmars-d-learn wrote:
Hello. Please see the following code:
import std.stdio ;
struct Pair {
int x, y ;
this (int x, int y) { x = x ; y = y ; }
}
void main() {
auto P = Pair(1, 2) ;
writeln(P.x, ' ', P.y) ;
}
This
On 10/22/2014 11:37 PM, Jonathan M Davis wrote:
x = x;
which is so obviously wrong that I don't know how much of anyone could
make that mistake. But simply making it illegal to assign a variable to
itself would solve that problem, and that arguably should be done, since
it's a essentially
On Thursday, 23 October 2014 at 18:57:33 UTC, Ali Çehreli wrote:
On 10/22/2014 11:37 PM, Jonathan M Davis wrote:
x = x;
which is so obviously wrong that I don't know how much of
anyone could
make that mistake. But simply making it illegal to assign a
variable to
itself would solve that
On Thursday, 23 October 2014 at 18:57:33 UTC, Ali Çehreli wrote:
On 10/22/2014 11:37 PM, Jonathan M Davis wrote:
x = x;
which is so obviously wrong that I don't know how much of
anyone could
make that mistake. But simply making it illegal to assign a
variable to
itself would solve that
Hello. Please see the following code:
import std.stdio ;
struct Pair {
int x, y ;
this (int x, int y) { x = x ; y = y ; }
}
void main() {
auto P = Pair(1, 2) ;
writeln(P.x, ' ', P.y) ;
}
This outputs 0 0, whereas the equivalent C++ code outputs 1 2 correctly:
#
On Thu, Oct 23, 2014 at 10:33:53AM +0530, Shriramana Sharma via
Digitalmars-d-learn wrote:
Hello. Please see the following code:
import std.stdio ;
struct Pair {
int x, y ;
this (int x, int y) { x = x ; y = y ; }
Please don't write code like this. How is the compiler supposed
Hello. I perfectly realize that it's not advisable to take advantage
of shadowing. In fact, I asked the question because I thought D
specifically *didn't* allow shadowing, but here it is, being silently
permitted to mishappen... I seem to read to have read that (D didn't
allow shadowing) but I'm
On Thu, Oct 23, 2014 at 11:01:10AM +0530, Shriramana Sharma via
Digitalmars-d-learn wrote:
Hello. I perfectly realize that it's not advisable to take advantage
of shadowing. In fact, I asked the question because I thought D
specifically *didn't* allow shadowing, but here it is, being silently
12 matches
Mail list logo