Type helpers instead of UFCS
BBasile via Digitalmars-d
digitalmars-d at puremagic.com
Sun Sep 13 10:23:23 PDT 2015
On Sunday, 13 September 2015 at 17:17:18 UTC, bitwise wrote:
> On Saturday, 12 September 2015 at 20:37:37 UTC, BBasile wrote:
>> UFCS is good but there are two huge problems:
>> - code completion in IDE. It'will never work.
>
> By this do you mean completion will be flooded?
>
> If so, then +1.
>
> I would much prefer something like C# extension methods, but
> where the first argument has to be typed so that every random
> template UFC under the sun doesn't appear in completion.
>
> class Foo {
> void foo() {}
> }
>
> void bar(this Foo foo, int arg) { } // fine
> void baz<T>(this T t) { } // compile error: first arg
> can't be a template
> void boo(Foo foo) // fine, but can't be used like a UFC
>
> int Main(string[] args) {
> Foo foo = new Foo();
> foo.bar(1); // fine
> foo.baz(); // error, undefined method 'baz'
> boo(foo); // fine
> foo.boo(); // error, undefined method 'boo'
> }
Yes this exactly what I meant. But a few hours after starting the
topic i'm less excited about the feature. I was biased by the
fact that i uniquely use DCD while there is of course also
A.Bothe completion system and the default Visual D completion
(don't know if it's been droped since the last time i used VD but
there was setting to use Bothe's completion system in stead of
VD's one).
More information about the Digitalmars-d
mailing list