On Friday, 21 August 2015 at 20:01:21 UTC, Vladimir Panteleev
wrote:
This warning almost doesn't break any code! Yes it flipping
does. It does break some code, but only in certain extremely
specialized contexts like memory allocation! No it's bleeping
not. Many of those warnings are probably
On Saturday, 22 August 2015 at 21:23:19 UTC, Timon Gehr wrote:
For the comma operator, I think it's pretty clear that the
usage of ',' to separate components of a tuple would be more
useful.
Why not use C/C++/C# initializer syntax? Technically it's a
tuple, but not related to comma operator.
On Friday, 21 August 2015 at 11:34:42 UTC, Marc Schütz wrote:
On Thursday, 20 August 2015 at 19:41:44 UTC, Jonathan M Davis
wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven
Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should
be illegal.
On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins wrote:
Hi!
string a = ;
string b;
writeln(a ? a : null);
writeln(b ? b : null);
This program outputs:
a
null
What?
I suppose this is by design, but are there any plans to
deprecate this?
Sounds correct to me.
On 08/22/2015 12:04 AM, Jonathan M Davis wrote:
On Friday, 21 August 2015 at 21:13:35 UTC, David Nadlinger wrote:
On Friday, 21 August 2015 at 20:01:21 UTC, Vladimir Panteleev wrote:
This warning almost doesn't break any code!
It indeed doesn't break almost any code. Yours is quite the
On Saturday, 22 August 2015 at 21:23:19 UTC, Timon Gehr wrote:
For the comma operator, I think it's pretty clear that the
usage of ',' to separate components of a tuple would be more
useful.
(With L-T-R evaluation, replacing usages of the comma operator
is easy, e.g. 'a,b,c' becomes
On 08/23/2015 01:09 AM, deadalnix wrote:
On Saturday, 22 August 2015 at 21:23:19 UTC, Timon Gehr wrote:
For the comma operator, I think it's pretty clear that the usage of
',' to separate components of a tuple would be more useful.
(With L-T-R evaluation, replacing usages of the comma operator
On 08/22/2015 02:04 AM, deadalnix wrote:
On Thursday, 20 August 2015 at 20:39:01 UTC, Timon Gehr wrote:
On 08/20/2015 10:26 PM, David Nadlinger wrote:
On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins wrote:
Having 2 empty strings evaluate differently is very unintuitive and
On Thursday, 20 August 2015 at 19:41:44 UTC, Jonathan M Davis
wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven
Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should
be illegal. If you really want to check for null, then you need
to use is
On 8/20/15 11:15 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 20:43:39 UTC, Steven Schveighoffer wrote:
This makes me think you misunderstand what I am doing.
If you care about whether an array is empty, you check whether its
length is 0 or you call empty (which checks whether
On 08/21/2015 12:50 PM, Steven Schveighoffer wrote:
So checking whether the array is null (i.e. empty) *is* what I'm doing,
Nah, you're checking whether it /equals/ null. :-)
On Friday, 21 August 2015 at 10:50:40 UTC, Steven Schveighoffer
wrote:
On 8/20/15 11:15 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 20:43:39 UTC, Steven
Schveighoffer wrote:
This makes me think you misunderstand what I am doing.
If you care about whether an array is empty, you
On Friday, 21 August 2015 at 13:54:04 UTC, Vladimir Panteleev
wrote:
Also, at least spell my name right please.
Sorry.
- Jonathan M Davis
On Friday, 21 August 2015 at 09:14:16 UTC, Kagamin wrote:
On Thursday, 20 August 2015 at 20:26:09 UTC, David Nadlinger
wrote:
It's even worse: http://dpaste.dzfl.pl/ba3376feca8e
The arrays are equal, but their Boolean value is not.
I don't get how Andrei can reconcile this with his D avoids
On 8/21/15 10:12 AM, Jonathan M Davis wrote:
I know full-well that that's what you're doing, but that's not what your
average programmer is going to expect. Anyone not intimately familiar
with the ins and outs of D's arrays - or even a D programmer who's not
paying really close attention - is
On Friday, 21 August 2015 at 11:43:11 UTC, Steven Schveighoffer
wrote:
On 8/21/15 7:34 AM, Marc =?UTF-8?B?U2Now7x0eiI=?=
schue...@gmx.net wrote:
On Thursday, 20 August 2015 at 19:41:44 UTC, Jonathan M Davis
wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven
Schveighoffer wrote:
if(arr
On Thursday, 20 August 2015 at 17:32:24 UTC, Jonathan M Davis
wrote:
On Thursday, 20 August 2015 at 17:01:07 UTC, anonymous wrote:
A compiler change disallowing such use of arrays was done and
then reverted. See
https://issues.dlang.org/show_bug.cgi?id=4733. I haven't
followed things closely
On Friday, 21 August 2015 at 14:34:49 UTC, Steven Schveighoffer
wrote:
On 8/21/15 10:12 AM, Jonathan M Davis wrote:
I know full-well that that's what you're doing, but that's not
what your
average programmer is going to expect. Anyone not intimately
familiar
with the ins and outs of D's
On Friday, 21 August 2015 at 13:54:04 UTC, Vladimir Panteleev
wrote:
It broke a crapton of my code.
… in a way for which a fix is trivial to automate, even without a
full-fledged parser.
– David
On Friday, 21 August 2015 at 13:54:04 UTC, Vladimir Panteleev
wrote:
On Thursday, 20 August 2015 at 17:32:24 UTC, Jonathan M Davis
wrote:
On Thursday, 20 August 2015 at 17:01:07 UTC, anonymous wrote:
A compiler change disallowing such use of arrays was done and
then reverted. See
On Friday, 21 August 2015 at 20:01:21 UTC, Vladimir Panteleev
wrote:
This warning almost doesn't break any code!
It indeed doesn't break almost any code. Yours is quite the
outlier.
— David
On 08/21/2015 10:01 PM, Vladimir Panteleev wrote:
I just write code this way, because I find the empty/null distinction
obvious and useful. Shocking, I know.
One of the main reasons this might be considered shocking is because
DMD does not cleanly make this distinction. [] is null.
On Friday, 21 August 2015 at 16:55:18 UTC, David Nadlinger wrote:
On Friday, 21 August 2015 at 13:54:04 UTC, Vladimir Panteleev
wrote:
It broke a crapton of my code.
… in a way for which a fix is trivial to automate, even without
a full-fledged parser.
Sure.
All things considered, I'm not
On Friday, 21 August 2015 at 21:13:35 UTC, David Nadlinger wrote:
On Friday, 21 August 2015 at 20:01:21 UTC, Vladimir Panteleev
wrote:
This warning almost doesn't break any code!
It indeed doesn't break almost any code. Yours is quite the
outlier.
In general, it gets a bit interesting when
On 8/21/15 7:34 AM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net
wrote:
On Thursday, 20 August 2015 at 19:41:44 UTC, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should
On 08/21/2015 01:34 PM, Marc =?UTF-8?B?U2Now7x0eiI=?=
schue...@gmx.net wrote:
On Thursday, 20 August 2015 at 19:41:44 UTC, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null
On Friday, 21 August 2015 at 11:43:11 UTC, Steven Schveighoffer
wrote:
On 8/21/15 7:34 AM, Marc =?UTF-8?B?U2Now7x0eiI=?=
schue...@gmx.net wrote:
I disagree. `is null` is the one that should be illegal. `is`
is
supposed to do a bitwise comparison, but `null` is usually
just a
pointer/reference,
On 08/21/2015 01:43 PM, Steven Schveighoffer wrote:
null is technically a no-type placeholder (defaulting to void * without
context).
It now defaults to typeof(null), which is a distinct type from void*.
The same is confusingly not true for [] though, which still defaults to
void[].
On Thursday, 20 August 2015 at 20:39:01 UTC, Timon Gehr wrote:
On 08/20/2015 10:26 PM, David Nadlinger wrote:
On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins
wrote:
Having 2 empty strings evaluate differently is very
unintuitive and
error-prone, in my opinion.
It's even worse:
On Friday, 21 August 2015 at 11:34:42 UTC, Marc Schütz wrote:
On Thursday, 20 August 2015 at 19:41:44 UTC, Jonathan M Davis
wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven
Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should
be illegal.
On Thursday, 20 August 2015 at 20:26:09 UTC, David Nadlinger
wrote:
It's even worse: http://dpaste.dzfl.pl/ba3376feca8e
The arrays are equal, but their Boolean value is not.
I don't get how Andrei can reconcile this with his D avoids
unforced errors stance.
The only technical excuse for the
On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins wrote:
Hi!
string a = ;
string b;
writeln(a ? a : null);
writeln(b ? b : null);
This program outputs:
a
null
What?
I suppose this is by design, but are there any plans to
deprecate this?
A compiler change disallowing such
On Thursday, 20 August 2015 at 20:43:39 UTC, Steven Schveighoffer
wrote:
This makes me think you misunderstand what I am doing.
If you care about whether an array is empty, you check whether
its length is 0 or you call empty (which checks whether the
length is 0). If you care about whether
On 08/20/2015 07:50 PM, Steven Schveighoffer wrote:
Very true. Not much we can do about it. For now, the best thing to do is
always compare arrays to null instead of simply if(arr):
if(arr != null)
Alternatively, but a little more ugly, is to check the length:
if(arr.length)
Isn't the best
On Thursday, 20 August 2015 at 18:04:00 UTC, Steven Schveighoffer
wrote:
On 8/20/15 1:50 PM, Steven Schveighoffer wrote:
The truthiness of an array says it's true ONLY if both the
pointer and
length are 0.
Ugh, *false* only if they are both 0. If either are not zero,
then it's true.
On 08/20/2015 08:05 PM, H. S. Teoh via Digitalmars-d wrote:
On Thu, Aug 20, 2015 at 01:50:11PM -0400, Steven Schveighoffer via
Digitalmars-d wrote:
[...]
The main reason why it caused issues is this nice idiom:
if(auto arr = someFunction())
{
// use arr
}
This would HAVE to be split out
On 08/20/2015 07:32 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:01:07 UTC, anonymous wrote:
A compiler change disallowing such use of arrays was done and then
reverted. See https://issues.dlang.org/show_bug.cgi?id=4733. I
haven't followed things closely enough to give you a
On 8/20/15 1:50 PM, Steven Schveighoffer wrote:
The truthiness of an array says it's true ONLY if both the pointer and
length are 0.
Ugh, *false* only if they are both 0. If either are not zero, then it's
true.
-Steve
On Thu, Aug 20, 2015 at 01:50:11PM -0400, Steven Schveighoffer via
Digitalmars-d wrote:
[...]
The main reason why it caused issues is this nice idiom:
if(auto arr = someFunction())
{
// use arr
}
This would HAVE to be split out to two statements, and the arr variable
would be scoped
On Thursday, 20 August 2015 at 17:01:07 UTC, anonymous wrote:
A compiler change disallowing such use of arrays was done and
then reverted. See
https://issues.dlang.org/show_bug.cgi?id=4733. I haven't
followed things closely enough to give you a good summary.
Basically, almost everyone wanted
On 8/20/15 12:45 PM, =?UTF-8?B?Ik3DoXJjaW8=?= Martins\
marcio...@gmail.com\ wrote:
Hi!
string a = ;
string b;
writeln(a ? a : null);
writeln(b ? b : null);
This program outputs:
a
null
What?
I suppose this is by design, but are there any plans to deprecate this?
The truthiness of an
On 08/20/2015 10:38 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 19:54:22 UTC, Steven Schveighoffer wrote:
On 8/20/15 3:41 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, ==
On 08/20/2015 10:43 PM, Steven Schveighoffer wrote:
On 8/20/15 4:38 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 19:54:22 UTC, Steven Schveighoffer wrote:
On 8/20/15 3:41 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer
wrote:
if(arr
On 8/20/15 4:45 PM, Timon Gehr wrote:
On 08/20/2015 10:43 PM, Steven Schveighoffer wrote:
On 8/20/15 4:38 PM, Jonathan M Davis wrote:
And why would you want that? The length is meaningless if the pointer is
null. It shouldn't even be possible for the length to be anything other
than zero if
On 8/20/15 4:38 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 19:54:22 UTC, Steven Schveighoffer wrote:
On 8/20/15 3:41 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null
On Thursday, 20 August 2015 at 19:54:22 UTC, Steven Schveighoffer
wrote:
On 8/20/15 3:41 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven
Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should
be
illegal. If you really
On 08/20/2015 10:26 PM, David Nadlinger wrote:
On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins wrote:
Having 2 empty strings evaluate differently is very unintuitive and
error-prone, in my opinion.
It's even worse: http://dpaste.dzfl.pl/ba3376feca8e
The arrays are equal, but
On Thursday, 20 August 2015 at 18:42:56 UTC, Márcio Martins wrote:
On Thursday, 20 August 2015 at 18:04:00 UTC, Steven
Schveighoffer wrote:
On 8/20/15 1:50 PM, Steven Schveighoffer wrote:
The truthiness of an array says it's true ONLY if both the
pointer and
length are 0.
Ugh, *false* only
On 8/20/15 3:04 PM, =?UTF-8?B?Ik3DoXJjaW8=?= Martins\
marcio...@gmail.com\ wrote:
On Thursday, 20 August 2015 at 18:42:56 UTC, Márcio Martins wrote:
On Thursday, 20 August 2015 at 18:04:00 UTC, Steven Schveighoffer wrote:
On 8/20/15 1:50 PM, Steven Schveighoffer wrote:
The truthiness of an
On 08/20/2015 09:54 PM, Steven Schveighoffer wrote:
On 8/20/15 3:41 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should be
illegal. If you really want to check for
On 08/20/2015 09:08 PM, Steven Schveighoffer wrote:
On 8/20/15 2:49 PM, Timon Gehr wrote:
On 08/20/2015 08:05 PM, H. S. Teoh via Digitalmars-d wrote:
On Thu, Aug 20, 2015 at 01:50:11PM -0400, Steven Schveighoffer via
Digitalmars-d wrote:
[...]
The main reason why it caused issues is this nice
On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins wrote:
Having 2 empty strings evaluate differently is very unintuitive
and error-prone, in my opinion.
It's even worse: http://dpaste.dzfl.pl/ba3376feca8e
The arrays are equal, but their Boolean value is not.
I don't get how Andrei
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer
wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should be
illegal. If you really want to check for null, then you need to
use is null or !is null, whereas if you want to check that an
array is
On 8/20/15 3:41 PM, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer wrote:
if(arr != null)
Definitely don't do that. IMHO, == null and != null should be
illegal. If you really want to check for null, then you need to use is
null or !is null, whereas
On 8/20/15 2:49 PM, Timon Gehr wrote:
On 08/20/2015 08:05 PM, H. S. Teoh via Digitalmars-d wrote:
On Thu, Aug 20, 2015 at 01:50:11PM -0400, Steven Schveighoffer via
Digitalmars-d wrote:
[...]
The main reason why it caused issues is this nice idiom:
if(auto arr = someFunction())
{
// use
On 8/20/15 2:43 PM, Timon Gehr wrote:
On 08/20/2015 07:50 PM, Steven Schveighoffer wrote:
Very true. Not much we can do about it. For now, the best thing to do is
always compare arrays to null instead of simply if(arr):
if(arr != null)
Alternatively, but a little more ugly, is to check the
On 08/20/2015 09:08 PM, Steven Schveighoffer wrote:
On 8/20/15 2:43 PM, Timon Gehr wrote:
On 08/20/2015 07:50 PM, Steven Schveighoffer wrote:
Very true. Not much we can do about it. For now, the best thing to do is
always compare arrays to null instead of simply if(arr):
if(arr != null)
Hi!
string a = ;
string b;
writeln(a ? a : null);
writeln(b ? b : null);
This program outputs:
a
null
What?
I suppose this is by design, but are there any plans to deprecate
this?
I understand this happens because in this context, string.ptr is
evaluated, but should a string really
58 matches
Mail list logo