On Wednesday, 17 April 2024 at 03:13:46 UTC, Liam McGillivray
wrote:
On Wednesday, 17 April 2024 at 02:39:25 UTC, Paul Backus wrote:
This is called [row polymorphism][1], and it does not exist in
D.
You could approximate it by making `someFunction` a template,
and accepting any type `T` that
On Wednesday, 17 April 2024 at 03:13:46 UTC, Liam McGillivray
wrote:
Is there a way I can replace "`TypeB`" in the function
parameters with another symbol, and then define that symbol to
accept `TypeB` as an argument, but also accept `TypeA` which
would get converted to `TypeB` using a
On Wednesday, 17 April 2024 at 02:39:25 UTC, Paul Backus wrote:
This is called [row polymorphism][1], and it does not exist in
D.
You could approximate it by making `someFunction` a template,
and accepting any type `T` that has the necessary members
instead of only accepting `typeB`. But
On Wednesday, 17 April 2024 at 01:36:59 UTC, Liam McGillivray
wrote:
To better understand what I mean, take the following example,
where I have a function, and two structs.
```
struct typeA {
// Some member variables here
}
struct typeB {
// Some similar member variables here, but in a
I have two structs that serve roughly the same purpose, and I
would like one to be accepted when the other is declared as a
function parameter.
To better understand what I mean, take the following example,
where I have a function, and two structs.
```
struct typeA {
// Some member