[fpc-devel] Generics

Flávio Etrusco flavio.etrusco at gmail.com
Sun Apr 9 23:51:36 CEST 2006


I hope I'm not being too annoying, I'm just trying to understand
better your decision/opinion. If you think this discussion is useless
please speak and I'll shut up ;-)

> Well, talking about Java's speed never makes sense.

LOL, I agree :-)

> Fact is, if you use
> classes that you've always an indirection because of the pointer and
> extra memory manager overhead while for simple tasks you can use simple
> embed the data into the container data when using real templates.

I know, and using "type erasure" will even frequently force the use of
inheritance (virtual/dynamic methods) that will add a little more
overhead, but thing is I can't see much use for generics for low level
tasks.
There are relatively few native types that is usually ok duplicate the
whole code if it need be. And it seems to me that absolutely most of
the times we are working with classes instead of just single primitive
variables, so I still fail to see where "generic for non-objects"
would be a big loss.

> > I guess I was a bit too hasty on the whining, but just thinking about
> > C++ compilation speed when using templates give me cries...
>
> This has nothing to do with templates.

I've read the opposite many times, but I know that it's much related
to C++ pre-processor, headers and linking models, and -again- I'm no
C++ or compilers expert. If you say it won't be an issue in FPC, I'm
happier then :-)

However, I'm still worried about the bloat that templates tend to add
to the binary/executable and about the difficulty of debugging
templates (not to say that I prefer name/symbol resolution only
through inheritance instead of pre-compiler/macro so much better)...

Cheers,
Flávio



More information about the fpc-devel mailing list