Type helpers instead of UFCS
Idan Arye via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 12 15:44:39 PDT 2015
On Saturday, 12 September 2015 at 20:37:37 UTC, BBasile wrote:
> That's why I propose the new keywords 'helper' and 'subject'
> that will allow to extend the properties pre-defined for a
> type, as long as the helper is imported:
>
> ---
> module myhelper;
> helper for subject : string
Do we really need a 3-keyword chain? What's wrong with a simple
`helper : string` or `helper(string)`?
> {
> void writeln()
> {
> import std.stdio;
> writeln(subject);
> }
> }
> ---
Why `subject` to refer to the string the function gets called on?
What's wrong with good old `this`, which is used for this purpose
everywhere else?
More information about the Digitalmars-d
mailing list