bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-recutils] child records and inheritance


From: OLLIER Jean-François
Subject: [bug-recutils] child records and inheritance
Date: Sat, 19 Feb 2011 22:51:36 +0100
User-agent: Mutt/1.4.2.2i

Sometimes we may have to create very similar records, with different names.

E.G, We set up an Assets inventory:

%rec: asset
%type: purchaseDAte date
%type: price real
%type: vendor regexp /vendor_regexp/

Suppose we want now to set up another Database, with material/equipments not 
considered as assets, e.g. pencils

%rec: pencil
%type: purchaseDAte date
%type: price real
%type: vendor regexp /vendor_regexp/
%type: count int

Obviously the majority of the fields are identical, except for the additional 
one.
We may consider that the 'pencil' record is no more than an 'asset' over-loaded 
child record,
just like in an object-oriented language, where a child class may over-load an 
inherited 'mother class'.

I propose to implement the inheritance notion in recutils records.
We may think about something like:

%rec: asset
%type: purchaseDAte date
%type: price real
%type: vendor regexp /vendor_regexp/

%rec: pencil
%inherits: asset
%type: count int

Now Suppose we want to do the same thing with plastic glasses, we could write:

%rec: glass
%inherits: asset
%type: count int

Or better:

%rec: glass
%inherits: pencil

------------------------------------------------------------------------------
The benefits
------------------------------------------------------------------------------

Obviously we may reduce considerably the rec files size when the records 
include a lot of similar fields that
dont need to be replicated in each child record any more, and obtain record 
files still closer to the recutils policy:
Human-readable/writable Data Base.
-- 
Jean-François OLLIER
mailto:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]