On 23.09.23 05:11, Vitaliy Fadeev wrote:
On Friday, 22 September 2023 at 19:50:17 UTC, Christian Köstlin wrote:
another option could be to model your own VTable in a struct like this:
https://run.dlang.io/is/3LTjP5
Kind regards,
Christian
Thank, Christian !
True nice tasty solution with
On 23.09.23 05:25, Vitaliy Fadeev wrote:
On Friday, 22 September 2023 at 19:50:17 UTC, Christian Köstlin wrote:
On 17.09.23 17:05, Vitaliy Fadeev wrote:
Hi!
You could model it oop style like this:
https://run.dlang.io/is/MJb5Fk
This solution might not be to your taste, as it involves
On Friday, 22 September 2023 at 19:50:17 UTC, Christian Köstlin
wrote:
On 17.09.23 17:05, Vitaliy Fadeev wrote:
Hi!
You could model it oop style like this:
https://run.dlang.io/is/MJb5Fk
This solution might not be to your taste, as it involves
interfaces, and classes and objects and garbage
On Friday, 22 September 2023 at 21:37:37 UTC, Imperatorn wrote:
On Friday, 22 September 2023 at 14:03:40 UTC, Vitaliy Fadeev
wrote:
On Friday, 22 September 2023 at 12:53:28 UTC, Imperatorn wrote:
You're basically just describing polymorphism. I can post an
example tomorrow, it's midnight here
On Friday, 22 September 2023 at 19:50:17 UTC, Christian Köstlin
wrote:
another option could be to model your own VTable in a struct
like this:
https://run.dlang.io/is/3LTjP5
Kind regards,
Christian
Thank, Christian !
True nice tasty solution with ```VTable```!
And further... the project is
On Friday, 22 September 2023 at 14:03:40 UTC, Vitaliy Fadeev
wrote:
On Friday, 22 September 2023 at 12:53:28 UTC, Imperatorn wrote:
On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev
wrote:
[...]
What I mean is, why not use other language constructs like
mixins or inheritance with
On 17.09.23 17:05, Vitaliy Fadeev wrote:
Hi!
I want to change a method ```Draw``` on a custom object when the
```MouseIn``` event occurs.
This is known as "Change State" of the object: ```Init``` -> ```Hovered```.
I want to change the state of an object by changing its class, like this:
```d
On Friday, 22 September 2023 at 12:53:28 UTC, Imperatorn wrote:
On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev
wrote:
On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev
wrote:
...
```
Chip
id
name
Sense()
Draw()
```
instance
```
chip = new Chip();
```
On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev
wrote:
On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev
wrote:
...
```
Chip
id
name
Sense()
Draw()
```
instance
```
chip = new Chip();
```
compiled to
```
chip
__vtbl -> Chip
On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev
wrote:
On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev
wrote:
...
the most correct
```
chip
__vtbl ---+ // one of
__monitor |
id|
name |
|-> Chip // init
|
On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev
wrote:
...
```
Chip
id
name
Sense()
Draw()
```
instance
```
chip = new Chip();
```
compiled to
```
chip
__vtbl -> Chip
__monitor Sense()
idDraw()
On Thursday, 21 September 2023 at 18:19:47 UTC, Imperatorn wrote:
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
Hi!
I want to change a method ```Draw``` on a custom object when
the ```MouseIn``` event occurs.
This is known as "Change State" of the object: ```Init``` ->
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
Hi!
I want to change a method ```Draw``` on a custom object when
the ```MouseIn``` event occurs.
This is known as "Change State" of the object: ```Init``` ->
```Hovered```.
[...]
Interesting, but why would you want to do
On Sunday, 17 September 2023 at 17:10:16 UTC, evilrat wrote:
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
It works! But I want to ask how to make this 100% the best of
the best?
What should I consider before changing ```__vptr``` ?
If that works for you with that
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
It works! But I want to ask how to make this 100% the best of
the best?
What should I consider before changing ```__vptr``` ?
If that works for you with that constraint of having exact memory
layout then it should be ok.
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
...
Playground: https://run.dlang.io/is/hjcLCk
Hi!
I want to change a method ```Draw``` on a custom object when the
```MouseIn``` event occurs.
This is known as "Change State" of the object: ```Init``` ->
```Hovered```.
I want to change the state of an object by changing its class,
like this:
```d
this.__vptr = typeid(CLS).vtbl.ptr;
17 matches
Mail list logo