[chuck-users] what is the syntax for casting an array of objects?

Robert Poor rdpoor at gmail.com
Sat Mar 20 11:47:58 EDT 2010

Here's a self-contained example that demonstrates what I mean:

class Obs {}
class SubObs extends Obs {}

fun void count(Obs elems[]) { <<< elems.size() >>>; }

// works...
[(new Obs), (new Obs)] @=> Obs @ x1[];

// works but is really ugly..
[(new SubObs) $ Obs, (new SubObs) $ Obs] @=> Obs x2[];

// Doesn't work: needs casting.  but what's the syntax?
[(new SubObs), (new SubObs)] @=> SubObs @ x3[];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100320/afc2a9cb/attachment.htm>

More information about the chuck-users mailing list