Re: [racket] Choosing what class to instantiate at runtime

2012-06-27 Thread Matthias Felleisen
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 val

Re: [racket] Choosing what class to instantiate at runtime

2012-06-27 Thread Kieron Hardy
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

Re: [racket] Choosing what class to instantiate at runtime

2012-06-26 Thread Danny Yoo
> The solution that springs to mind is to choose which class to instantiate > with (if (list? param-a) ,,,) but then I'd have to state the parameter lists > twice. Hi Kieron, Can you choose the class using an if or cond? For example: (define

[racket] Choosing what class to instantiate at runtime

2012-06-25 Thread Kieron Hardy
Hi all, I'd like to refactor and extend the code below, such that r is either defined to be an instance of an item-representer% or a multi-item-representer%, depending on whether param-a is a single item or a list. The solution that springs to mind is to choose which class to instantiate with (if