Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.lang.pascal > #3

Re: Generic data structures

From "zeLittle " <noreply@noreply.net>
Newsgroups alt.comp.lang.pascal
Subject Re: Generic data structures
Date 2016-10-05 00:10 +0200
Organization ZL
Message-ID <op.yotw63xlc5b0tx@mainate> (permalink)
References <20160507163854.84ad1a21bf36c1a99cd7c3d1@gmail.com>

Show all headers | View raw


>
> The problem with this approach is that it will break
> the  program  when  the  TGenList  or Node structure
> changes or when the memory layout (alignment) in the
> generic list unit differs from that in the importing
> unit.  Is there a better approach?
>

Hello (a long time I haven't write in Pascal),

maybe replace the record's field "Number: byte; { fields here }" with an  
object: what's more casual and generic? Rewrite this field with "Fo_data:  
TDataObject". Create a family inherited from TDataObject, to carry a  
string (TDataStringObject), a pointer (TDataStringObject), and so on.

Honnestly, look at M. Fowler to know how to implement a double linked list  
(there must be a link-manager which handle all th job (attach and detach  
like the Observer pattern), only active in ***one*** list: the  
"TMasterList" for exemple <-- it's very important, because the management  
the relations in 2 one-to-one lists will become a nightmare.

Back to alt.comp.lang.pascal | Previous | NextPrevious in thread | Find similar


Thread

Generic data structures Anton Shepelev <anton.txt@gmail.com> - 2016-05-07 16:38 +0300
  Re: Generic data structures "zeLittle " <noreply@noreply.net> - 2016-10-04 23:51 +0200
  Re: Generic data structures "zeLittle " <noreply@noreply.net> - 2016-10-05 00:10 +0200

csiph-web