UFCS for classes with opCall( ... )

Timon Gehr timon.gehr at gmx.ch
Sun Jun 2 13:48:47 PDT 2013


On 06/01/2013 02:22 PM, ParticlePeter wrote:
> Hello,
>
> after watching Walters Talk about Component Programming ( link Bellow )
> I was quite fond of his pipelining approach.
> I tried the following and had to realize that this way using UFCS isn't
> working ( or I do something wrong ).
>
> // I want to write On Canvas1 | draw Shape1 | draw Shape2 | ... in code
> ( not working ):
> canvas1.shape1.shape2.draw()
>
> // Which in essence would be ( working ):
> shape2( shape1( canvas1 ) ).draw()
> ...

UFCS is working with opCall already.

The reason your code does not work is that UFCS only works with 
module-level symbols (and with the latest release also for locally 
imported symbols IIRC.)




More information about the Digitalmars-d-learn mailing list