`with (TemplateInstance):` shoild work

Stefan Koch uplink.coder at googlemail.com
Fri Aug 21 09:47:04 UTC 2020


On Friday, 21 August 2020 at 05:10:14 UTC, Andrei Alexandrescu 
wrote:
> I just tried this:
>
> template x() {
>     void fun(int) {}
> }
>
> void main() {
>     with (x!()) {
> 	    42.fun();
>     }
> }
>
> It works, and it's a great way to inject UFCS symbols. But at 
> best it should work with the colon syntax so it applies through 
> the end of scope/module:
>
> with (x!()):
>
> void main() {
>     42.fun();
> }
>
> Once that is possible, you get to inject UFCS symbols into a 
> module with ease.

You would need a DIP for the colon synatx.

I would be in support of with:

As for using template instances, yeah ...
maybe not



More information about the Digitalmars-d mailing list