[chuck-users] a few language questions

Michael Heuer heuermh at gmail.com
Fri Nov 9 15:50:37 EST 2007


A couple more:

If an array is defined but not instantiated with a capacity

Object @ values[];

should it be possible to instantiate it later with a capacity of nulls?

Object @ [100] @=> values[];


How about a cast?

class MyEvent extends Event
{
  int value;
}

fun void handleEvent(Event event)
{
  <<< ((MyEvent) event).value >>>;
}

Thanks,

   michael


Michael Heuer wrote:

> Hello,
>
> I have a few chuck language questions:
>
> Is it possible to define a "growing" array?  The associative portion
> of the array grows without bounds but I can't see how to do that with
> the indexed portion.
>
> Object @ list[];
> for (0 => int i; i < 100; i++)
> {
>   Object o @=> list[i];
> }
>
> Is it possible to check a reference against null?
>
> Object @ list[100];
> 0 => int size;
> for (0 => int i; i < list.cap(); i++)
> {
>   if (list[i] is null?)
>   {
>     size++;
>   }
> }
>
> Is there a "String toString()" or similar method on Object?  I wish to
> override  "Expressions which represent an object will print the value
> of that object's reference address".
>
> Do reflective methods exist on the base Object type (its "Class")?
> e.g.  Function[] getFunctions(); ...
>
> Thanks,
>
>    michael


More information about the chuck-users mailing list