On Friday, 9 August 2013 at 07:22:12 UTC, barryharris wrote:
On Friday, 9 August 2013 at 04:33:52 UTC, barryharris wrote:

  auto test2 = New!AnotherTest("test2", 20);
oops, should read:

auto test2 = New!AnotherTest(20);

--------------------
-1 for me anyway for the following reason:

A.function(args)    // I know A is a function value parameter
function!A(args)    // I know A is a template type parameter
function!10(args)   // I know 10 is a template type parameter
10.function(args)   // I know 10 is a function value parameter

So I don't like it...

To clarify, that above is what we have now but with the OP suggestion

A.function(args)

becomes too ambiguous as to whether A is a template parameter or function parameter (i.e. refers to type or value)

I agree. I briefly considered the following syntax to help disambiguate it:

    A!function(args)

But then this code would be confusing:

    void func(alias pred)(int x) {}
    func!(func)(3);

Which function is the template argument? The same goes for the dot operator, if A happens to be an alias to a function.

I don't think this is inline (sorry for the pun...) with the intent of UFCS, which IMHO was to make methods less special:

    class A {
        void foo();
    }
    void bar(A a);

    A a;
    a.foo();
    a.bar();

This way you can make a function call look like a method call. This is what the compiler does internally anyway (if I'm not mistaken), so it makes sense to allow the programmer to do this, which can be very useful in extending types.

Reply via email to