[Golist] Sequencing function calls and passing arguments

Moses Gunesch moses at goasap.org
Wed May 21 08:52:57 PDT 2008


On May 21, 2008, at 1:16 AM, Jud Holliday wrote:

> Okay, so I know I’m a bit behind the times here, but this past week  
> I finally got my head around how to sequence with Go and I have to  
> say that so far I am loving it!

Jud: Cool! (BTW, if anyone wants to help me figure out how to  
communicate GoASAP's lightness and simplicity more clearly, please  
write me off list!!! I cannot seem to do this.)

>
> So, long story short, I have started to put together some basic  
> tweening classes (and Graeme is making new additions as well) which  
> will be posted soon to the playground. Included so far are:
> PositionTween, AlphaTween, BlurTween, and CallbackTrigger

Woo hoo!! Can't wait to get these.... whoever does this first will  
really set the standards that tons of Go users will grab, so I'm glad  
someone is finally taking up my offer to get famous.

>
> So the next thing I wanted to do is pass some arguments to the  
> function call

> 1.       Am I going about this in an overly complicated way?/Is  
> there already a system in place to accomplish this?

Like Donovan said you can already pass arguments using a nested  
closure. However, that tends to be kind of illegible so i think that  
your system makes a lot of sense.

> 2.       If not, then does addCallbackWithParams make sense, or is  
> there another way to add the ability to pass parameters to a  
> callback in LinearGo? This seems like a really handy feature.

I like it a lot. The other approach which i almost took with Go (until  
someone pointed out the nested closure thing, at which time i figured  
that was far simpler), was to have a special callback class, that  
wrapped the closure, the arguments, and the GoEvent type to associate  
the callback to. One nice thing about having such a class is that you  
can pass callbacks in an array, and each one defines its own type.  
However, your approach is nice and simple too.

I think it's a great topic to be discussing. The ultimate thing would  
be something that worked anywhere around the Go kit (with physics  
animations eventually). You know Jud, I think the best version of the  
class you're writing there would be to just implement IPlayable/ 
PlayableBase but not extend LinearGo. That way you have a 'playable  
callback' class that can be included in groups as you're doing here,  
but can be used directly without LinearGo's overhead or extra features.

- m






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://goasap.org/pipermail/golist_goasap.org/attachments/20080521/af5b4d14/attachment.html 


More information about the GoList mailing list