slang-users mailing list

[2012 Date Index] [2012 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] What is DataType_Type??


Hi Duke,

> I gather then that a datatype cannot be "assigned" to a variable.
> Is that correct?
No. Just as `b' in your example, you can define:
  variable b2 = Double_Type;

> So what's a DataType_Type?? 
DataType_Type is the type that describes datatypes... ;-)
See the end of §4.1 @ http://www.jedsoft.org/slang/doc/html/slang-4.html

> A catch-all type, sort of?
I'm not sure what you mean, though I agree it's a kind of meta-DataType.
But you can use it just as any other type:

  private variable my_favourites = DataType_Type[3];
  my_favourites[0] = Array_Type;
  my_favourites[1] = Double_Type;
  my_favourites[2] = Integer_Type;

  define is_one_of_my_favourite_types(value)
  {
     return any( my_favourites == typeof(value) );
  }

Cheers,

Manfred

	
> -------------------------------8<---------------------------------------
> a=2.3;
> 
> () = printf ( "The variable 'a' has this data-type %S\n", typeof(a)
> );
> 
> variable b = typeof(a);
> 
> () = printf ( "The variable 'b' has this data-type %S\n", typeof(b)
> );




[2012 date index] [2012 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]