[Issue 8381] Uniform function call syntax (pseudo member) enhancement suggestions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 12 10:08:17 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8381



--- Comment #3 from Tommi <tommitissari at hotmail.com> 2012-07-12 10:08:16 PDT ---
(In reply to comment #1)
> - The rule is non-obvious. How could a new developer possibly guess that this
> happens?

You could also argue that it's not obvious that:
var.func(arg);

...can "transform" itself into:
func(var, arg);

I don't think it's that much different to transform:
MyType.func(arg);

...into:
func!(MyType)(arg);

It almost looks like we're trying to pass MyType as first argument to the
function, but because we can't pass type as function argument, we pass it as
first template argument. But you're right that none of that is very obvious.
Maybe the whole uniform function call syntax could have been implemented
somehow differently so that it had been more intuitive to people new to the
language.


(In reply to comment #1)
> Supposing that I would like to extend the set of static members in class Foo.
> How about:
> 
> module A;
> // assuming "static class" does not already have any meaning?
> static class Foo {
>     static void F();
>     static int x;
> }

But I really mean type when I say, "extending the functionality of a type". I
mean not only class but all user defined types as well, like enum, struct and
union.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list