digitalmars.D - `with (TemplateInstance):` shoild work
- Andrei Alexandrescu (18/18) Aug 20 2020 I just tried this:
- Mathias LANG (12/18) Aug 20 2020 Would the following suit your needs ?
- Andrei Alexandrescu (2/26) Aug 21 2020 Ah, nice. Thanks!
- Stefan Koch (6/24) Aug 21 2020 You would need a DIP for the colon synatx.
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.
Aug 20 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();
}
```
Aug 20 2020
On 8/21/20 2:49 AM, Mathias LANG wrote:On Friday, 21 August 2020 at 05:10:14 UTC, Andrei Alexandrescu wrote:Ah, nice. Thanks!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(); } ```
Aug 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
Aug 21 2020









Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> 