tardy v0.0.1 - Runtime polymorphism without inheritance

Atila Neves atila.neves at gmail.com
Tue Jun 16 09:15:10 UTC 2020


On Tuesday, 16 June 2020 at 03:56:52 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:
>> https://code.dlang.org/packages/tardy
>> https://github.com/atilaneves/tardy
>>
>
> Looks interesting, nice work!
>
> How does it compare to:
> https://dlang.org/phobos/std_experimental_typecons#.wrap ?

For starters, that uses a class and inheritance internally and 
therefore has all the drawbacks of that approach as laid out in 
tardy's README.md. Then there's the lack of allocator support.

> In the more longer-term, is the goal of the project to 
> implement a Typescript / Go interfaces like structural type 
> system in user space?

Yes. Other than allowing multiple interfaces, I think it's 
already implemented.

> Also how would it compare to Rust traits?

Rust's traits are usually used like D's template contraints and 
Haskell's type classes. The only way they're relevant here are 
trait objects:

https://doc.rust-lang.org/reference/types/trait-object.html

The main difference is that tardy is supposed to give the user 
choices over how the dispatch is actually implemented. Allocators 
alone are huge.

> I guess the main difference, would be that Rust enforces a 
> nominal type system like approach, where 2 differently named 
> traits that otherwise define the same interface are not 
> considered interchangeable.

Yes, that's also a difference.




More information about the Digitalmars-d-announce mailing list