Hi all,
Recently I read the paper "Classes and Mixins" by Matthew Flatt, Shriram
Krishnamurthi and Matthias Felleisen.
In this paper, the authors presented MIXEDJAVA.
In MIXEDJAVA,
> A programmer implements mixins in exactly the same
> way as a derived class, except that the programmer cannot
>
I don't know of a way to solve that problem using the Racket class system
alone, but here is a solution that uses traits instead, which allow you to
rename the hook methods after the fact so they don't collide.
;;
(require racket/trait)
(define secure-trait
(trait
(inherit nee
Dear Ryan,
Thanks for your solution, it works nicely!
But I still have some questions:
For this particular problem of LockedMagicDoor, we can use `trait` to solve
the `mixin` problem, but can we use the same method for more general
problems?
Since traits and mixins are essentially different, th
On Wed, Aug 12, 2020 at 7:19 PM Siyuan Chen wrote:
> Dear Ryan,
>
> Thanks for your solution, it works nicely!
>
> But I still have some questions:
>
> For this particular problem of LockedMagicDoor, we can use `trait` to
> solve the `mixin` problem, but can we use the same method for more genera
Dear Ryan,
No, traits can contain fields, which are mutable, so a trait can manage
> state.
>
Thanks, I tested it.
You are right, traits can manage states.
Right, one trait cannot override another's definitions. One thing you
> could do instead is use `trait-exclude` to remove the definition
5 matches
Mail list logo