- Subject: Re: [slang-users] What is DataType_Type??
- From: Duke Normandin <dukeofperl@xxxxxxxxxxx>
- Date: Tue, 20 Nov 2012 07:24:20 -0700
On Tue, 20 Nov 2012 07:18:02 +0100
Manfred Hanke <Manfred.Hanke@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 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) );
> }
> > -------------------------------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) );
>
> _______________________________________________
Hey, Manfred ....
Thanks for the explanation! Got it!!
--
Duke
_______________________________________________
slang-users-l mailing list
slang-users-l@xxxxxxxxxxx
http://mailman.jedsoft.org/mailman/listinfo/slang-users-l
[2012 date index]
[2012 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]