DIP23 draft: Fixing properties redux
Steven Schveighoffer
schveiguy at yahoo.com
Sun Feb 3 08:33:03 PST 2013
On Sun, 03 Feb 2013 11:28:52 -0500, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> As for templates that return a templated type, it should be allowed,
> although the calling syntax would have to be for the explicit template
> call, since you can't do IFTI on return values. In other words:
>
> template x(T) { @property T x(){return to!(T)(_x);} } // could be
> shortened to normal @property T x(T)()
>
> auto xcopy = obj.x!(string).x;
Hm... I actually am changing my mind on this, you should be able to do:
auto xcopy = obj.x!(string);
For the simple reason that if @property is omitted, this would work
(simple lack of parens). It makes no sense to make properties not have
this ability.
-Steve
More information about the Digitalmars-d
mailing list