Hmmm... Curious case, I think it's a bug; Depends on if inner
functions qualify for overloading or not.
//globally or in struct/class/union works fine
int test() {return 0;}
void test(int x) {}
unittest {
int test() {return 0;}
void test(int x) {} //test already defined
}
It's conform to the spec
http://dlang.org/function.html
Last line of the 'nested functions' subsection:
"Nested functions cannot be overloaded."
Nested functions cannot be overloaded.
On Tuesday, 8 January 2013 at 21:12:34 UTC, Philippe Sigaud wrote:
It's conform to the spec
http://dlang.org/function.html
Last line of the 'nested functions' subsection:
"Nested functions cannot be overloaded."
Nested functions cannot be overloaded.
Hmm I seemed to have missed that.
That
On Tue, Jan 8, 2013 at 10:43 PM, Era Scarecrow wrote:
> Hmm I seemed to have missed that.
>
> That just means my unittest wouldn't work, so either it has to be global or
> inside a struct/union/class (and global is not very likely).
>
> Thanks for clearing that up.
I had a bunch of troubles tr
Philippe Sigaud:
I had a bunch of troubles trying to define nested functions
automatically generated. The fact that they cannot be recursive
killed
the deal for me (that was for a parser, which needs recursion).
If you define an inner static struct, its static methods can call
each other fr
On 1/9/13, bearophile wrote:
> If you define an inner static struct, its static methods can call
> each other freely.
You can also use a mixin template:
mixin template S()
{
void test(ref int x) { x = test(); }
int test() { return 1; }
}
void main()
{
mixin S;
int x;
test(x
On Wednesday, 9 January 2013 at 00:53:16 UTC, Andrej Mitrovic
wrote:
mixin template S()
{
void test(ref int x) { x = test(); }
int test() { return 1; }
}
void main()
{
mixin S;
int x;
test(x);
assert(x == 1);
}
An interesting idea, but the more obvious uses it would b
On Wed, Jan 9, 2013 at 1:53 AM, Andrej Mitrovic
wrote:
> On 1/9/13, bearophile wrote:
>> If you define an inner static struct, its static methods can call
>> each other freely.
>
> You can also use a mixin template:
>
> mixin template S()
> {
> void test(ref int x) { x = test(); }
> int t
On Wednesday, 9 January 2013 at 10:53:53 UTC, Philippe Sigaud
wrote:
On Wed, Jan 9, 2013 at 1:53 AM, Andrej Mitrovic wrote:
On 1/9/13, bearophile wrote:
If you define an inner static struct, its static methods can
call each other freely.
You can also use a mixin template:
mixin template S()
Am 08.01.2013 22:43, schrieb Era Scarecrow:
On Tuesday, 8 January 2013 at 21:12:34 UTC, Philippe Sigaud wrote:
It's conform to the spec
http://dlang.org/function.html
Last line of the 'nested functions' subsection:
"Nested functions cannot be overloaded."
Nested functions cannot be overloaded
On Wednesday, 9 January 2013 at 12:03:30 UTC, dennis luehring
wrote:
Am 08.01.2013 22:43, schrieb Era Scarecrow:
That just means my unittest wouldn't work, so either it has to
be global or inside a struct/union/class (and global is not
very likely).
Thanks for clearing that up.
isn't tha
On Wed, Jan 9, 2013 at 12:52 PM, Era Scarecrow wrote:
>> That's weird. Why does that work? Directly pasting the mixin content in
>> main() does not compile, right?
>
> I can only assume if it does work, that the mixin template has it's own
> scope that enables the overloading. If you can't do it
Am 09.01.2013 14:21, schrieb Philippe Sigaud:
On Wed, Jan 9, 2013 at 12:52 PM, Era Scarecrow wrote:
That's weird. Why does that work? Directly pasting the mixin content in
main() does not compile, right?
I can only assume if it does work, that the mixin template has it's own
scope that enab
On 01/08/2013 10:12 PM, Philippe Sigaud wrote:
It's conform to the spec
http://dlang.org/function.html
Last line of the 'nested functions' subsection:
"Nested functions cannot be overloaded."
Nested functions cannot be overloaded.
Note that this is a case of the spec being adapted to the
im
On Friday, 11 January 2013 at 01:49:03 UTC, Timon Gehr wrote:
On 01/08/2013 10:12 PM, Philippe Sigaud wrote:
"Nested functions cannot be overloaded."
Note that this is a case of the spec being adapted to the
implementation. It has been added after I complained about the
DMD behaviour.
So
On 1/10/2013 5:49 PM, Timon Gehr wrote:
> On 01/08/2013 10:12 PM, Philippe Sigaud wrote:
>> It's conform to the spec
>>
>> http://dlang.org/function.html
>>
>> Last line of the 'nested functions' subsection:
>>
>> "Nested functions cannot be overloaded."
>> Nested functions cannot be overloaded.
>
16 matches
Mail list logo