2011/8/7 okay_awright <[email protected]>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello Romain.

Hi!

> I'm really sorry, my description was clear as mud.
>
> - From what I understand, the procedure/function for each "case" of the
> switch is evaluated during intialization (I read in the doc that once
> the script is parsed, the graph is built and related objects are
> created, and you call that instantiation I think.) The outcome of the
> predicates is settled at that time - except when we deal with
> time-related operators I think. I just came to this conclusion using
> printf() and markers within test scripts. I'm maybe wrong though. Please
> correct me.
>
> Anyway, what I'd love to get are "case" functions that are 'visited'
> each time a branch of the switch must be selected - a real dynamic
> operator, where case predicates are evaluated each time the switch
> operates. It's like the regular switch, except that the "cases" behave
> more like 'event' triggers (like on_track(), on_end(), on_connect(), etc.)
>
> Myabe I'm mistaken and the original switch doesn't really behave the way
> I've described. Please tell me if there's a solution/workaround/whatever
> to make the switch act like a true dynamic operator.

Actually the predicates in the different branches of the switch are
evaluated dynamically :-)
Each of them is a function of type: () -> bool, i.e. a function that
takes no parameter and returns true if the source ought to be played..

What must be confusing is the notation: { 1h-4h }. This notation is a
shortcut for:
def predicate() =
  1h-4h
end

More generally, { foo } is a shortcut for the function: () -> foo..

In any case, the predicates are evaluated regularly. You may use for
them any function of your choice. This I believe the switch does
behave the way you want :-)

Romain

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to