Thread overview
Compiler bug? regression for the template function call syntax
May 31, 2013
rmc
May 31, 2013
Ali Çehreli
May 31, 2013
Jonathan M Davis
May 31, 2013
bearophile
May 31, 2013
Hi all,

Not sure if this is a bug so thought I'd post here.

It is very common to use a function template without the call "()" expecting that it will be called. However with the latest compilers hibernated only compiles when one leaves out the -property dmd command line option.

The call:
getColumnName!(MemberTest, "simple")

Has to be changes to:
getColumnName!(MemberTest, "simple")()

Now do that everywhere a template function is used.

Any help?

Thanks.
Rory
May 31, 2013
On 05/31/2013 07:32 AM, rmc wrote:

> It is very common to use a function template without the call "()"
> expecting that it will be called.

Non-templated functions too.

> However with the latest compilers
> hibernated only compiles when one leaves out the -property dmd command
> line option.

I think it is the same issue with non-templated functions. The best thing to do is to forget about the -property switch. I did about a year ago and never looked back. :)

If you need to use the -property switch, then define the function with the @property attribute:

@property
void getColumnName(T, string s)() {
    // ..
}

Ali

May 31, 2013
On Friday, May 31, 2013 08:27:19 Ali Çehreli wrote:
> I think it is the same issue with non-templated functions. The best thing to do is to forget about the -property switch. I did about a year ago and never looked back. :)

Given the most recent discussions on @property, I think that it's a foregone conclusion that we will never have strict property enforcement (which is what -property is trying to do), and -property will be going away at some point in the future. The general consensus is that folks want optional parens and not have that have anything to do with @property. I think that the only real question at this point is what happens with setters, as some folks want setters to be restricted to @property, and others just want to go to the behavior we had before @property and not need @property at all. For the most part, at this point, @property is looking like a failure.

- Jonathan M Davis
May 31, 2013
Ali Çehreli:

> The best thing to do is to forget about the -property
> switch. I did about a year ago and never looked back. :)

But the whole issue of -property was a partial failure for the D community and D designers. Several threads, hundreds of posts, and I see no clear directives or solution. And the current solution is not good.

Bye,
bearophile