March 25, 2023 General » Re: It's basically Hindley-Milner. | |||
|---|---|---|---|
| |||
...It's but a convenient example to demonstrate the problem with D's `alias` anyway. | |||
March 24, 2023 Learn » Re: Implicit type conversion depending on assignment | |||
|---|---|---|---|
| |||
...import std.variant;
private Variant[string] values;
alias values this;
@property
{
Variant opDispatch(string key... | |||
March 24, 2023 Learn » Re: Implicit type conversion depending on assignment | |||
|---|---|---|---|
| |||
...fine for structs:
```
struct MyInt {
int x;
alias x this;
this(MyString s) {
x = s... | |||
March 24, 2023 General » Re: It's basically Hindley-Milner. | |||
|---|---|---|---|
| |||
...template Vec3(T) {
alias Vec3 = Matrix!(T, 3, 1);
template opResolveAlias(alias U)
{
static if... | |||
March 24, 2023 General » Re: It's basically Hindley-Milner. | |||
|---|---|---|---|
| |||
...S, size_t M, size_t N)
{
}
alias Vec3(S) = Matrix!(S, 3, 1);
```
What... | |||
March 24, 2023 Learn » Re: Implicit type conversion depending on assignment | |||
|---|---|---|---|
| |||
...or other operators for a struct, just alias the value to `this` and use `std... | |||
March 24, 2023 General » Re: It's basically Hindley-Milner. | |||
|---|---|---|---|
| |||
...it: for now, D allows writing template alias paramters, but AFAIK they will match absolutely... | |||
March 24, 2023 General » Re: It's basically Hindley-Milner. | |||
|---|---|---|---|
| |||
My apologies, correction: `A` is a 'trivial alias'. Sorry for the minipost, but this topic... | |||
March 24, 2023 Learn » Re: Implicit type conversion depending on assignment | |||
|---|---|---|---|
| |||
BTW, you can also `alias this` your struct value and then use `std.conv : to... | |||
March 24, 2023 General » It's basically Hindley-Milner. | |||
|---|---|---|---|
| |||
...with concrete types. Finally, in our example: ``` alias A(T) = B!T; void foo(T... | |||
Copyright © 1999-2021 by the D Language Foundation