[fpc-pascal] linked list to criticize

spir ☣ denis.spir at gmail.com
Mon May 3 12:48:00 CEST 2010

On Mon, 3 May 2010 16:02:32 +1000
"Paul Nicholls" <paulfnicholls at gmail.com> wrote:

> Hi Denis,
>   nice :)
> I'm curious, why didn't you make it a class...wouldn't that have made it
> nicer/easier to use and program?

Yes, for sure. Not beeing able to use the OO syntax is really a pain! (Even inside the LinkedList unit itself.) But it is all what we miss, I guess.

One point for me precisely was to write it from scratch, without any higher-level OO structure (object, class). Explore the techniques and issues of writing OO-like code in a language that would not come equipped with such a framework.

A side-question is also to avoid overloading code with a prebuilt OO layer, for efficiency (*). I take the opportunity to ask about the speed cost of using FreePascal's class-system vs plain Pascal. And the same about using objects vs plain records. I have no idea about this. Are there some data about this?


(*) Even more because in a while I intend to write a custom OO system (prototype-based). Building it on top FreePascal's class system makes a double OO layer, from client code(s point of view.

PS: I have slightly changed the online code:
* Replaced methods in correct order (for me), thank to one of you pointing me to "forward" :-)
* List_new now accepts directly an optional array of startup elements, not a pointer to it (I discovered arrays can have a 'nil' default.)

vit esse estrany ☣


More information about the fpc-pascal mailing list