Thread overview
dmd 0.40 release
Sep 08, 2002
Walter
Sep 09, 2002
Patrick Down
Sep 09, 2002
Walter
Sep 09, 2002
anderson
Sep 09, 2002
Walter
September 08, 2002
Implemented templates.

ftp://ftp.digitalmars.com/dmdalpha.zip

Not well tested :-( just proof of concept.


September 09, 2002
"Walter" <walter@digitalmars.com> wrote in news:alglfa$6l0$1 @digitaldaemon.com:

> Implemented templates.
> 
> ftp://ftp.digitalmars.com/dmdalpha.zip
> 
> Not well tested :-( just proof of concept.
> 
> 

It not a template bug.  But I've found the
following problem.  The following program
incorrectly prints:

Inside: 12,34
Outside: 14,11

struct Size
{
  int width;
  int height;
}

Size computeSize()
{
  Size foo;

  foo.width = 12;
  foo.height = 34;

  printf("Inside: %d,%d\n",foo.width,foo.height);

  return foo;
}

int main(char[][] argv)
{
  Size bar;
  bar = computeSize();

  printf("Outside: %d,%d\n",bar.width,bar.height);

  return 0;
}
September 09, 2002
"Patrick Down" <pat@codemoon.com> wrote in message news:Xns9283ED9A04DDBpatcodemooncom@63.105.9.61...
> It not a template bug.  But I've found the
> following problem.  The following program
> incorrectly prints:

Thanks, I have it fixed now. It'll go out in the next update.


September 09, 2002
That was fast! D really moving along.


"Walter" <walter@digitalmars.com> wrote in message news:alglfa$6l0$1@digitaldaemon.com...
> Implemented templates.
>
> ftp://ftp.digitalmars.com/dmdalpha.zip
>
> Not well tested :-( just proof of concept.
>
>


September 09, 2002
"anderson" <anderson@firestar.com.au> wrote in message news:alhk11$2k80$1@digitaldaemon.com...
> That was fast! D really moving along.
> "Walter" <walter@digitalmars.com> wrote in message
> news:alglfa$6l0$1@digitaldaemon.com...
> > Implemented templates.

There's about 1/4th as much code to do templates in D as opposed to templates in C++ ! The savings came from:

1) explicit, rather than implicit, instantiation
2) being about to group related declarations under one template declaration
3) elimination of the nuisance of const/volatile in type deduction
4) elimination of template parsing/lexical ambiguities
5) elimination of overloading rules between template and non-template
functions
6) elimination of the type dependent and type independent name lookup rules

One thing I kept was the brilliant C++ partial specialization idea. Stripped of the complexity of the C++ version, it is marvelous how slick it works.

Of course, since nobody has yet attempted to build a D STL, I might be all screwed up here. We'll see.