On Thursday, 26 April 2012 at 03:44:27 UTC, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the
type, or part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior in
the bug
On 04/26/2012 05:44 AM, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both,
That is how it should be.
which leads to the nasty behavior in the
On 4/26/2012 12:47 AM, Timon Gehr wrote:
On 04/26/2012 05:44 AM, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both,
That is how it should be.
On 26/04/12 05:44, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior in the bug
report.
The problem centers
On 2012-04-26 05:44, Walter Bright wrote:
But if we make default arguments solely a part of the function
declaration, then function pointers (and delegates) cannot have default
arguments. (And maybe this isn't a bad thing?)
Why not?
--
/Jacob Carlborg
On 04/26/2012 09:54 AM, Walter Bright wrote:
On 4/26/2012 12:47 AM, Timon Gehr wrote:
On 04/26/2012 05:44 AM, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
On 04/26/2012 10:51 AM, Don Clugston wrote:
On 26/04/12 05:44, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty
On 26/04/12 11:28, Timon Gehr wrote:
On 04/26/2012 10:51 AM, Don Clugston wrote:
On 26/04/12 05:44, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are
On 26/04/12 11:21, Timon Gehr wrote:
On 04/26/2012 09:54 AM, Walter Bright wrote:
On 4/26/2012 12:47 AM, Timon Gehr wrote:
On 04/26/2012 05:44 AM, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See
On 04/26/2012 11:46 AM, Don Clugston wrote:
On 26/04/12 11:28, Timon Gehr wrote:
On 04/26/2012 10:51 AM, Don Clugston wrote:
On 26/04/12 05:44, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See
On 04/26/2012 11:54 AM, Don Clugston wrote:
On 26/04/12 11:21, Timon Gehr wrote:
On 04/26/2012 09:54 AM, Walter Bright wrote:
On 4/26/2012 12:47 AM, Timon Gehr wrote:
On 04/26/2012 05:44 AM, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the
type, or
part of
On 26/04/12 12:11, Timon Gehr wrote:
On 04/26/2012 11:46 AM, Don Clugston wrote:
On 26/04/12 11:28, Timon Gehr wrote:
On 04/26/2012 10:51 AM, Don Clugston wrote:
On 26/04/12 05:44, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the
type, or
part of the
I've always thought of default arguments to be plain syntactic sugar, so
for void f(int i, int j=5)f(1) is simply transformed to f(1,5) and the
rest is the same.
On 2012-04-26 03:44:07 +, Walter Bright newshou...@digitalmars.com said:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior
Le 26/04/2012 05:44, Walter Bright a écrit :
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior in the bug
report.
The problem
Walter:
A subtle but nasty problem - are default arguments part of the
type, or part of the declaration?
I'm waiting for years to see you finally facing this problem too
:-) The current situation is not acceptable, so some change of
the current situation is required, probably a small
Michel Fortin:
That said, there was some talk about adding support for named
parameters a year ago.
Good reminder. I think such parts of D shouldn't be designed one
of a time. If you want to face the problem of default arguments,
it's better to think about named arguments too (even if you
On Wed, 25 Apr 2012 23:44:07 -0400, Walter Bright
newshou...@digitalmars.com wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the
On 26/04/12 05:44, Walter Bright wrote:
But if we make default arguments solely a part of the function declaration, then
function pointers (and delegates) cannot have default arguments. (And maybe this
isn't a bad thing?)
I can't see disallowing default arguments as being a good thing. For
On Thu, 26 Apr 2012 09:08:07 -0400, Steven Schveighoffer
schvei...@yahoo.com wrote:
void main()
{
auto a = (int x = 1) { return x;};
pure nothrow @safe int function(int) b = (int x) { return x;};
pragma(msg, typeof(a).stringof);
pragma(msg, typeof(b).stringof);
b = a;
On Wed, Apr 25, 2012 at 10:39:01PM -0700, Walter Bright wrote:
On 4/25/2012 10:29 PM, Ary Manzana wrote:
I don't understand the relationship between two delegate types being
the same and thus sharing the same implementation for default
arguments for *different instances* of a delegate with the
On Apr 25, 2012, at 9:10 PM, Walter Bright newshou...@digitalmars.com wrote:
On 4/25/2012 8:44 PM, Walter Bright wrote:
The problem centers around name mangling. If two types mangle the same, then
they are the same type. But default arguments are not part of the mangled
string. Hence the
Walter Bright newshou...@digitalmars.com wrote in message
news:jnagar$2d8k$1...@digitalmars.com...
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads
On Thursday, April 26, 2012 13:54:47 bearophile wrote:
The simplest solution is to the breaking change of disallowing
default arguments for function pointers and delegates. This also
means disallowing talking the pointer/delegate of function with
default arguments.
No it doesn't. You could
On Thursday, April 26, 2012 15:09:15 Joseph Rushton Wakeling wrote:
On 26/04/12 05:44, Walter Bright wrote:
But if we make default arguments solely a part of the function
declaration, then function pointers (and delegates) cannot have default
arguments. (And maybe this isn't a bad thing?)
On 26/04/12 19:25, Jonathan M Davis wrote:
There is an _enormous_ difference between disallowing default arguments in
general and disallowing them in function pointers and delegates.
I think maybe I've misunderstood the problem. Are we talking about default
values _of the function pointer_
On Thursday, April 26, 2012 19:45:55 Joseph Rushton Wakeling wrote:
On 26/04/12 19:25, Jonathan M Davis wrote:
There is an _enormous_ difference between disallowing default arguments in
general and disallowing them in function pointers and delegates.
I think maybe I've misunderstood the
On Thu, 26 Apr 2012 06:10:14 +0200, Walter Bright
newshou...@digitalmars.com wrote:
On 4/25/2012 8:44 PM, Walter Bright wrote:
The problem centers around name mangling. If two types mangle the same,
then
they are the same type. But default arguments are not part of the
mangled
string.
int function(int) opAddrOf() { return fbody; }
That was wrong, this should be supported through implicit conversion.
On 4/26/2012 8:06 AM, Sean Kelly wrote:
Sounds to me like you just answered your own question :-)
Pretty much. I posted it here to see if I missed something major. Not that that
ever happens :-)
On 4/26/2012 2:21 AM, Timon Gehr wrote:
This is a matter of terminology. For example, for 'equal' just exclude the
default parameters from the comparison. For 'the same' include default
parameters in the comparison. (therefore, 'the same' implies 'equal')
I think this is torturing the
On 4/26/2012 1:54 AM, Jacob Carlborg wrote:
On 2012-04-26 05:44, Walter Bright wrote:
But if we make default arguments solely a part of the function
declaration, then function pointers (and delegates) cannot have default
arguments. (And maybe this isn't a bad thing?)
Why not?
Because a
On 04/26/2012 08:56 PM, Walter Bright wrote:
On 4/26/2012 2:21 AM, Timon Gehr wrote:
This is a matter of terminology. For example, for 'equal' just exclude
the
default parameters from the comparison. For 'the same' include default
parameters in the comparison. (therefore, 'the same' implies
Le 26/04/2012 20:49, Walter Bright a écrit :
On 4/26/2012 8:06 AM, Sean Kelly wrote:
Sounds to me like you just answered your own question :-)
Pretty much. I posted it here to see if I missed something major. Not
that that ever happens :-)
Why does default argument should be mangled at all
I've actually been making fairly extensive use of function/delegate default
args. I was pleasantly surprised when I realised it was possible.
Funnily enough, It's one of those things that I just expected should work
(as I find most things I just expect should work do in fact tend to work in
D), so
A subtle but nasty problem - are default arguments part of the type, or part of
the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior in the bug report.
The problem centers around name mangling. If two types
On Wednesday, April 25, 2012 20:44:07 Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or part
of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior in the bug
On Thursday, 26 April 2012 at 03:44:27 UTC, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the
type, or part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior in
the bug
On 4/25/2012 8:44 PM, Walter Bright wrote:
The problem centers around name mangling. If two types mangle the same, then
they are the same type. But default arguments are not part of the mangled
string. Hence the schizophrenic behavior.
One might suggest mangling the default argument into the
On Wed, Apr 25, 2012 at 08:44:07PM -0700, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type,
or part of the declaration?
My intuition suggests they are part of the declaration, but not part of
the type. For example, you could have two functions:
On 4/25/2012 9:42 PM, H. S. Teoh wrote:
This is bad. What if you have two delegates with different default
arguments? What would this code do:
auto foo = (int a=1) { return a; };
auto bar = (int a=2) { return a; };
writeln(foo());
writeln(bar());
?
Give you
On Wed, Apr 25, 2012 at 10:08:26PM -0700, Walter Bright wrote:
On 4/25/2012 9:42 PM, H. S. Teoh wrote:
This is bad. What if you have two delegates with different default
arguments? What would this code do:
auto foo = (int a=1) { return a; };
auto bar = (int a=2) { return a; };
On 4/25/2012 10:20 PM, H. S. Teoh wrote:
On Wed, Apr 25, 2012 at 10:08:26PM -0700, Walter Bright wrote:
On 4/25/2012 9:42 PM, H. S. Teoh wrote:
This is bad. What if you have two delegates with different default
arguments? What would this code do:
auto foo = (int a=1) { return a; };
On 4/26/12 11:44 AM, Walter Bright wrote:
A subtle but nasty problem - are default arguments part of the type, or
part of the declaration?
See http://d.puremagic.com/issues/show_bug.cgi?id=3866
Currently, they are both, which leads to the nasty behavior in the bug
report.
The problem centers
On 4/25/2012 10:29 PM, Ary Manzana wrote:
I don't understand the relationship between two delegate types being the same
and thus sharing the same implementation for default arguments for *different
instances* of a delegate with the same type.
Maybe a bug in how it's currently implemented?
If
45 matches
Mail list logo