One could write and maintain one set of generic linked list routines for a generic
type and write a PERL script to generate the actual code for all the actual types
for which the linked-list subroutines are required. Writing your own code
generation code is of course an additional burden which must be traded against
the cost of maintenance and possibility of error of manually maintaining the
separate sets of linked list subroutines.
The same code generation approach could be used for other generic procedures.
Whether this is a better way I am not sure?
>
> > You can write a program with specific routines to handle linked
> > lists of various types. A particular linked list operation (e.g.,
> > search and insert) can have a generic name that is used for all of
> > the linked lists that you have provided. Fortran will automatically
> > apply the generic operation to the linked list whose type
> > corresponds to the actual argument at each call. This is a pretty
> > straightforward combination of F90 generic procedures with standard
> > linked list techniques. Fortran 95 makes things a little bit simpler
> > with a few features such as default initialization of structures and
> > pointer initialization to NULL.
>
> Will I not _still_ have to rewrite each linked-list function for every
> type of data I want to put into a linked list? That would be a
> maintenance nightmare. Tell me there is a better way.
>
> -jack
>
--
David Vowles - Research Officer - The University of Adelaide
email: [log in to unmask]
phone: +61 8 8303-5416
fax: +61 8 8303-4360
Department of Electrical and Electronic Engineering
The University of Adelaide
Australia 5005
__________________________________________________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|