Nicolas Cannasse a écrit :
Marco Maggi a écrit :
It seems to me that the standard library
interface to int32 numbers lacks a function
to test if an abstract is of that kind.

static value int32_p (value v)
{
  return (val_is_int32(v))? val_true : val_false;
}

I guess a k_kind val_kind would be needed, with apis such as :

static value int32_kind() {
    return alloc_abstrac(k_kind,k_int32);
}

Then a builtin $is_kind(k,v) that would test if a value is of the given abstract type or not.

The following two apis have been added on CVS :

  $getkind : abstract -> 'kind
  <doc>Returns the kind value of the abstract</doc>

  $iskind : any -> 'kind -> bool
  <doc>Tells if a value is of the given kind</doc>

Best,
Nicolas

--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to