On Jun 27, 2012, at 12:39 PM, Kieron Hardy wrote:

> Thanks Danny, that's a step in the direction I wanted to go.
> 
> But on further reflection, I think what I was looking for (i.e. have some 
> class that stops it's own instantiation and defers to another class depending 
> on some parameter value(s)) doesn't really make sense. Instead I need some 
> sort of factory function that contains the conditionals and that returns an 
> instance of the right class.
> 
> Cheers,
> 
> Kieron


That's the correct way to parameterize instantiation, but Danny's conditional 
will play a role there: 

  (define (factory x)
    (new (if (is-this-tuesday?) class-for-tuesday class-for-all-other-days)
         [time x]))



____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to