Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-19 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 17 June 2020 at 16:01:29 UTC, Paul Backus wrote: On Tuesday, 16 June 2020 at 13:31:49 UTC, Atila Neves wrote: With a few changes, yes (added missing semicolons, changed IGeometry to Geometry in `measure`, passed the current module so tardy can find the UFCS functions, added

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-18 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 6/17/20 7:19 AM, Atila Neves wrote: On Wednesday, 17 June 2020 at 10:43:35 UTC, Stanislav Blinov wrote: On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: Tardy lets users have their cake and eat it too by not making them have to use classes for runtime polymorphism. I've got

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread Sebastiaan Koppe via Digitalmars-d-announce
On Wednesday, 17 June 2020 at 16:01:29 UTC, Paul Backus wrote: A while ago, I collaborated briefly with Adam Kowalski from the Dlang discord server on some code to emulate C++-style argument-dependent lookup in D. Using that code, your example above would be written:

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 17 June 2020 at 16:01:29 UTC, Paul Backus wrote: [snip] IMO this can be done more elegantly by separating out the code that looks up methods in the current module from the code that does the actual type erasure. A while ago, I collaborated briefly with Adam Kowalski from the

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 13:31:49 UTC, Atila Neves wrote: With a few changes, yes (added missing semicolons, changed IGeometry to Geometry in `measure`, passed the current module so tardy can find the UFCS functions, added `@safe pure` to the UFCS functions: [...] void main() {

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 17 June 2020 at 11:46:12 UTC, Atila Neves wrote: [snip] I think these questions are good motivators for making it interface-only since then I don't have to check for data definitions. Makes sense.

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 17 June 2020 at 11:31:09 UTC, jmh530 wrote: On Wednesday, 17 June 2020 at 10:04:59 UTC, Atila Neves wrote: [...] Cool. [...] If I'm understanding you correctly, you could modify Polymorphic (and a similar change to VirtualTable) to struct Polymorphic(Interface,

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 17 June 2020 at 10:04:59 UTC, Atila Neves wrote: [snip] I was going to say "it should work" but instead I wrote the code and... it does. It all falls out of how UFCS works and usual language rules.

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 17 June 2020 at 10:43:35 UTC, Stanislav Blinov wrote: On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: Tardy lets users have their cake and eat it too by not making them have to use classes for runtime polymorphism. I've got to ask though. Why "tardy"? Search

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread Stanislav Blinov via Digitalmars-d-announce
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: Tardy lets users have their cake and eat it too by not making them have to use classes for runtime polymorphism. I've got to ask though. Why "tardy"? Search engines be damned? :)

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 15:50:07 UTC, jmh530 wrote: On Tuesday, 16 June 2020 at 13:31:49 UTC, Atila Neves wrote: [snip] Pretty cool, thanks for the fixups. It may make for a good documentation example, in that it may help make clear that you need to pass the module in somehow when

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 13:31:49 UTC, Atila Neves wrote: [snip] Pretty cool, thanks for the fixups. It may make for a good documentation example, in that it may help make clear that you need to pass the module in somehow when dealing with non-member functions (AFAICT). You could include

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 12:30:24 UTC, jmh530 wrote: On Tuesday, 16 June 2020 at 11:31:14 UTC, Atila Neves wrote: On Tuesday, 16 June 2020 at 11:24:05 UTC, jmh530 wrote: On Tuesday, 16 June 2020 at 09:15:10 UTC, Atila Neves wrote: [snip] In the more longer-term, is the goal of the project

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 12:30:24 UTC, jmh530 wrote: [snip] double area(Rect r) { return r.width * r.height } double perim(Rect r) { return 2 * r.width + 2 * r.height } double area(Circle c) { import std.math: PI; return PI * c.radius * c.radius } double perim(Circle c) {

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 11:31:14 UTC, Atila Neves wrote: On Tuesday, 16 June 2020 at 11:24:05 UTC, jmh530 wrote: On Tuesday, 16 June 2020 at 09:15:10 UTC, Atila Neves wrote: [snip] In the more longer-term, is the goal of the project to implement a Typescript / Go interfaces like

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 11:24:05 UTC, jmh530 wrote: On Tuesday, 16 June 2020 at 09:15:10 UTC, Atila Neves wrote: [snip] 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

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 09:15:10 UTC, Atila Neves wrote: [snip] 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. I'm

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread Petar via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 09:15:10 UTC, Atila Neves wrote: 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,

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread Atila Neves via Digitalmars-d-announce
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:

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-16 Thread Atila Neves via Digitalmars-d-announce
On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy 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 [...] Wouldn't a top type be a better way to achieve this? -Alex How?

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Petar via Digitalmars-d-announce
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 ? In the more longer-term, is the goal of

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 15 June 2020 at 20:54:27 UTC, 12345swordy wrote: On Monday, 15 June 2020 at 20:51:38 UTC, Stefan Koch wrote: On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy wrote: On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread 12345swordy via Digitalmars-d-announce
On Monday, 15 June 2020 at 20:51:38 UTC, Stefan Koch wrote: On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy 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 [...] Wouldn't a top type be a

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy 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 [...] Wouldn't a top type be a better way to achieve this? -Alex the Talias in type functions

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread 12345swordy via Digitalmars-d-announce
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy https://github.com/atilaneves/tardy [...] Wouldn't a top type be a better way to achieve this? -Alex

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread jmh530 via Digitalmars-d-announce
On Monday, 15 June 2020 at 14:12:17 UTC, Atila Neves wrote: [snip] Yep: https://github.com/atilaneves/tardy/blob/d5f1102a6a791e77e0a27ee1a7920166fba8fcc8/tests/ut/polymorphic.d#L222 Thanks, I missed that.

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Atila Neves via Digitalmars-d-announce
On Saturday, 13 June 2020 at 18:39:14 UTC, Paul Backus 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 Cool stuff! What's the reasoning behind implementing your own vtables instead of using D's

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Atila Neves via Digitalmars-d-announce
On Saturday, 13 June 2020 at 16:15:49 UTC, jmh530 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 [snip] This is pretty cool. Thanks for sharing. I have a few questions/comments: 1) It might make

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-14 Thread Dukc via Digitalmars-d-announce
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy https://github.com/atilaneves/tardy If this is what you say, it could be used for object-oriented programing with types that are not designed as objects. Not only that, in principle the design

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-13 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 6/13/20 2:39 PM, Paul Backus 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 Cool stuff! What's the reasoning behind implementing your own vtables instead of using D's built-in object system?

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-13 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy https://github.com/atilaneves/tardy Cool stuff! What's the reasoning behind implementing your own vtables instead of using D's built-in object system? Don't want to be stuck inheriting from

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-13 Thread Sebastiaan Koppe via Digitalmars-d-announce
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: Tardy lets users have their cake and eat it too by not making them have to use classes for runtime polymorphism. This is one of those things that is so obvious in hindsight. Genius.

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-13 Thread jmh530 via Digitalmars-d-announce
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy https://github.com/atilaneves/tardy [snip] This is pretty cool. Thanks for sharing. I have a few questions/comments: 1) It might make a good blog post at some point to discuss this and the