On Wednesday, 8 November 2017 at 01:24:57 UTC, codephantom wrote:
On Sunday, 25 June 2017 at 23:21:25 UTC, aberba wrote:
Can you share feature(s) in D people are not talking about which you've found very useful?

How about this feature: i.e. it actually compiles just fine ;-)

//------------------------------------------------------------

module test;

void main()
{
    void main()
    {
        void main()
        {
            void main()
            {
                void main()
                {
                    void main()
                    {
                        void main()
                        {
//and so on... and so on....and so on....
                        }
                    }
                }
            }

        }
    }
}

//------------------------------------------------------------

I laughed.

At it's even funnier when you realize that there's actually generated assembly code for the nested main functions:

```
void test.main().main():
 push   %rbp
 mov    %rsp,%rbp
 sub    $0x10,%rsp
 mov    %rdi,-0x8(%rbp)
 leaveq
 retq
 xchg   %ax,%ax
```

However as you can see it only generates for one of the nested functions, the rest are omitted.

You can never call the function though :p

Reply via email to