Re: [racket-users] Mixin questions

2016-08-13 Thread Stephen De Gabrielle
Excellent write-write up !
On Fri, 12 Aug 2016 at 13:40, Matthias Felleisen 
wrote:

>
> You may want to scan this little write-up on first-class classes and
> mixins:
>
>
> http://www.ccs.neu.edu/home/matthias/Thoughts/Programming_with_Class_in_Racket.html
>
> I intended to push into the docs at some point, but we dropped the ball on
> it.
>
>
>
>
> > On Aug 12, 2016, at 8:13 AM, Normal Loone 
> wrote:
> >
> > How do I call the methodes of each mixin? When I tried something like
> (define/public ...) the other mixins could not access these.
> >
> >
> > Am Donnerstag, 11. August 2016 20:19:02 UTC+2 schrieb Robby Findler:
> >> Although, with these two particular interfaces, there is no single
> >> class that implements both. You would instead have two separate mixins
> >> that would communicate by calling each others methods.
> >>
> >> Robby
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Kind regards,
Stephen
--
Bigger than Scheme, cooler than Clojure & more fun than CL.(n=1)
--

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Mixin questions

2016-08-12 Thread Matthias Felleisen

You may want to scan this little write-up on first-class classes and mixins: 

  
http://www.ccs.neu.edu/home/matthias/Thoughts/Programming_with_Class_in_Racket.html

I intended to push into the docs at some point, but we dropped the ball on it. 




> On Aug 12, 2016, at 8:13 AM, Normal Loone  wrote:
> 
> How do I call the methodes of each mixin? When I tried something like 
> (define/public ...) the other mixins could not access these.
> 
> 
> Am Donnerstag, 11. August 2016 20:19:02 UTC+2 schrieb Robby Findler:
>> Although, with these two particular interfaces, there is no single
>> class that implements both. You would instead have two separate mixins
>> that would communicate by calling each others methods.
>> 
>> Robby
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Mixin questions

2016-08-12 Thread Normal Loone
How do I call the methodes of each mixin? When I tried something like 
(define/public ...) the other mixins could not access these.


Am Donnerstag, 11. August 2016 20:19:02 UTC+2 schrieb Robby Findler:
> Although, with these two particular interfaces, there is no single
> class that implements both. You would instead have two separate mixins
> that would communicate by calling each others methods.
> 
> Robby

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Mixin questions

2016-08-11 Thread Robby Findler
Although, with these two particular interfaces, there is no single
class that implements both. You would instead have two separate mixins
that would communicate by calling each others methods.

Robby


On Thu, Aug 11, 2016 at 12:09 PM, Daniel Feltey  wrote:
> If you want to inherit from both the frame and the tab in the mixin you
> would write something like:
>
> (mixin
>   (drracket:unit:frame<%>
>drracket:unit:tab<%>)
>   ()
>   ;; body
>   ...)
>
> In this case the mixin will only work on classes that implement both the tab
> and the frame interfaces, and you can now inherit methods from each
> interface.
>
> In general the 'mixin' form takes two lists of interfaces: the first are
> those that arguments to the mixin must implement, the second are those that
> the result of applying the mixin must implement.
>
> Hope this helps,
> Dan
>
>
>
> On Thursday, August 11, 2016, Normal Loone  wrote:
>>
>> Does that mean, I can not use inherit on tab% here? Because that's my
>> problem I need functions from both classes but I can only inherit from one,
>> the other always results in runtime errors.
>>
>> Is there a way to use more from-interfaces than just one? The they it's
>> worded suggested that you can use more than one parent interface.
>>
>> Like mainly, I want to use the function (current-tab) in frame% to figure
>> out the opened tab and acquire the file name it is referencing. And then in
>> tab% i want to override the function (break-callback) to print the filename
>> out when ever a program is cancelled (for some reason break-call is a
>> function in tab whereas execute-call is a function in frame...)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Mixin questions

2016-08-11 Thread Daniel Feltey
If you want to inherit from both the frame and the tab in the mixin you
would write something like:

(mixin
  (drracket:unit:frame<%>
   drracket:unit:tab<%>)
  ()
  ;; body
  ...)

In this case the mixin will only work on classes that implement both the
tab and the frame interfaces, and you can now inherit methods from each
interface.

In general the 'mixin' form takes two lists of interfaces: the first are
those that arguments to the mixin must implement, the second are those that
the result of applying the mixin must implement.

Hope this helps,
Dan


On Thursday, August 11, 2016, Normal Loone > wrote:

> Does that mean, I can not use inherit on tab% here? Because that's my
> problem I need functions from both classes but I can only inherit from one,
> the other always results in runtime errors.
>
> Is there a way to use more from-interfaces than just one? The they it's
> worded suggested that you can use more than one parent interface.
>
> Like mainly, I want to use the function (current-tab) in frame% to figure
> out the opened tab and acquire the file name it is referencing. And then in
> tab% i want to override the function (break-callback) to print the filename
> out when ever a program is cancelled (for some reason break-call is a
> function in tab whereas execute-call is a function in frame...)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Mixin questions

2016-08-08 Thread Normal Loone
Hello, 
I am having problems with the from-interfaces for mixins.

I want to make a function that uses functions defined in drracket:unit:frame<%> 
but itself is called by a function defined in drracket:unit:tab<%>

So I just tried to make a mixin:

(define on-break-mixin
  (mixin (drracket:unit:frame<%>) (drracket:unit:tab<%>)
   (super-new)
(inherit get-current-tab) ;unit-frame function
(inherit get-defs) ; unit-tab function

   (define/override (break-callback)
  ...
  )


Yet, I get error messages on start-up that the stuff from unit-tab is not in 
any of the from-interfaces.

How can I access stuff from a superclass in the child class or vice versa?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.