Thread overview
`with (TemplateInstance):` shoild work
Aug 21, 2020
Mathias LANG
Aug 21, 2020
Stefan Koch
August 21, 2020
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.
August 21, 2020
On Friday, 21 August 2020 at 05:10:14 UTC, Andrei Alexandrescu wrote:
>
> with (x!()):
>
> void main() {
>     42.fun();
> }
>
> Once that is possible, you get to inject UFCS symbols into a module with ease.

Would the following suit your needs ?

```
template x() {
    void fun(int) {}
}

mixin x;

void main() {
    42.fun();
}
```
August 21, 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

August 21, 2020
On 8/21/20 2:49 AM, Mathias LANG wrote:
> On Friday, 21 August 2020 at 05:10:14 UTC, Andrei Alexandrescu wrote:
>>
>> with (x!()):
>>
>> void main() {
>>     42.fun();
>> }
>>
>> Once that is possible, you get to inject UFCS symbols into a module with ease.
> 
> Would the following suit your needs ?
> 
> ```
> template x() {
>      void fun(int) {}
> }
> 
> mixin x;
> 
> void main() {
>      42.fun();
> }
> ```

Ah, nice. Thanks!