[Gambas-user] Templates

Emil Lenngren emil.lenngren at ...626...
Sat Jun 2 17:04:19 CEST 2012


That .net thing is generics, not templates.
C++ has real templates, i.e. different versions of the code is compiled for
each template parameters.
In java and .net generics, only one version of the code is compiled, and in
java, generics are only "syntax sugar" for casting things to and from the
"Object" base class.

In Gambas you can use the Variant datatype for similar purposes. For
example, the Collection class can be used with any datatype because it's
only storing Variants.

/Emil

2012/6/2 Demosthenes Koptsis <demosthenesk at ...626...>

> Στις 2/6/2012 17:07, ο/η Benoît Minisini έγραψε:
> > Le 02/06/2012 07:13, Demosthenes Koptsis a écrit :
> >> Hello list,
> >>
> >> i want to ask if there is a future plan to implement Templates in Gambas
> >> like .net
> >>
> >> example
> >>
> >> http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx#Y0
> >>
> >> 'Declaration
> >> <SerializableAttribute>    _
> >> Public  Class  List(Of T) _
> >>      Implements  IList(Of T), ICollection(Of T),  _
> >>      IEnumerable(Of T), IList, ICollection, IEnumerable
> >>
> > I have no plan to implement templates at the moment. Maybe in the
> > future, I don't know.
> >
> > There is already a rudimentary template mechanism inside the interpreter
> > to implement arrays of a specific class. But I don't think it can be
> > generalized.
> >
> > Regards,
> >
> ok, it would been nice feature for a future release.
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list