[fpc-pascal] Re: TLinkedList

Juha Manninen juha.manninen62 at gmail.com
Wed Feb 15 10:19:57 CET 2012


2012/2/15, Jorge Aldo G. de F. Junior <jagfj80 at gmail.com>:
> i once read a textbook about generics (C++ generics) showing how C++

C++ does not have generics, it has templates. Templates syntax is
complex, you can do actual programming with it. IMO, using all its
capacity leads to over-engineered and unreadable code.
I read about a plan to add Java style generics syntax to C++, in
addition to templates. I guess it will not happen. C++ has enough
syntax already.


> code can end up being FASTER than C equivalent due to lack of type
> checks...
>[...]
> the point being made was that object orientation is not necessarely
> "bloat" but leads to better written code. (not always true, but...)

Code can still be fast even if it is bloated in size. Object
orientation helps in writing readable and maintainable code but that
is yet another issue.
The code duplication we discussed here has no advantage for speed. It
is quite useless duplication.


>From Sven Barth:
> Free Pascal is a native language. There aren't much alternatives to code duplication.

Yes there is. The same container code can be reused (when possible),
just like Java does.
Free Pascal is native, Java generates byte-code, but that is irrelevant here.

I was planning to use generics in many places in Lazarus code but now
I must rethink...
Lazarus executable is quite big already.

Juha



More information about the fpc-pascal mailing list