On 2012-07-27 13:14, Jacob Carlborg wrote:
On 2012-07-27 12:29, Namespace wrote:
const(Foo) but ref Foo. This is inconsistency, if you ask me.
So why is between C++ and D such a huge difference?
Why isn't it simply const Foo instead of const(Foo)?
I think the reason is the same as above. If the return value is const
you need to use parentheses. I think that the syntax would conflict with
the const-method syntax otherwise.
The reason for why const is allowed after the paramter list is because
it can be a bit confusing to have two const next to each other.
class Foo
{
const const (Foo) foo () {}
}
Forgot to say, the reason for why the ref(Foo) syntax isn't used is
because there can be no conflict since methods cannot be declared as const.
--
/Jacob Carlborg