Thread overview
Abstraction for primitive types?
Apr 21, 2003
Helmut Leitner
Apr 24, 2003
Walter
Apr 24, 2003
Helmut Leitner
Apr 24, 2003
Walter
April 21, 2003
Is there an abstraction planned for primitive types?

Something that would allow to write generic interfaces like

   TypeToUnistring(type t) {
      TypeInfo *pti=t.info;
      char buf[40];
      int n=(*pti.toMem)(&t,buf);
      return MemRetUnistring(buf,n);
   }

or

   void ArrayRandomize(type [] ar) {
      ....
      algorithm using swap from typeinfo
      ....
   }

?

--
Helmut Leitner    leitner@hls.via.at Graz, Austria   www.hls-software.com
April 24, 2003
The t.info should work now.

"Helmut Leitner" <helmut.leitner@chello.at> wrote in message news:3EA3B257.6974D98D@chello.at...
> Is there an abstraction planned for primitive types?
>
> Something that would allow to write generic interfaces like
>
>    TypeToUnistring(type t) {
>       TypeInfo *pti=t.info;
>       char buf[40];
>       int n=(*pti.toMem)(&t,buf);
>       return MemRetUnistring(buf,n);
>    }
>
> or
>
>    void ArrayRandomize(type [] ar) {
>       ....
>       algorithm using swap from typeinfo
>       ....
>    }
>
> ?
>
> --
> Helmut Leitner    leitner@hls.via.at
> Graz, Austria   www.hls-software.com


April 24, 2003

Walter wrote:
> 
> The t.info should work now.

What means "now"? In the next version DMD 0.62?

> "Helmut Leitner" <helmut.leitner@chello.at> wrote in message news:3EA3B257.6974D98D@chello.at...
> > Is there an abstraction planned for primitive types?
> >
> > Something that would allow to write generic interfaces like
> >
> >    TypeToUnistring(type t) {
> >       TypeInfo *pti=t.info;
> >       char buf[40];
> >       int n=(*pti.toMem)(&t,buf);
> >       return MemRetUnistring(buf,n);
> >    }
> >
> > or
> >
> >    void ArrayRandomize(type [] ar) {
> >       ....
> >       algorithm using swap from typeinfo
> >       ....
> >    }
> >
> > ?
> >
> > --
> > Helmut Leitner    leitner@hls.via.at
> > Graz, Austria   www.hls-software.com

--
Helmut Leitner    leitner@hls.via.at Graz, Austria   www.hls-software.com
April 24, 2003
"Helmut Leitner" <helmut.leitner@chello.at> wrote in message news:3EA8443F.165D429E@chello.at...
>
>
> Walter wrote:
> >
> > The t.info should work now.
>
> What means "now"? In the next version DMD 0.62?

Yes, unless I goofed it up <g>.