Plans for stricter record semantics in R8

Francesco Cesarini cesarini@REDACTED
Mon Oct 16 18:32:31 CEST 2000


Bjorn Gustavsson wrote:
> 
> In R8, we preliminary plan to stricten the test for valid records

Great. Are there any plans of inserting generic functions on records as
well (or implementing O'Keef's suggestion from 1998)? Due to their
implementation, it is today impossible to write generic code using
different record types. There are however many cases where different
records can be treated equally as they share some common denominators.

Generic code of this kind is today handled by using the tuple
representation of records. (Do as I say, don't do as I do is what I end
up preaching....) And the code is static anyhow, as every time you add a
new record, you have to recompile the file with the generic stuff (or go
through a call back module which makes the code yucky and hard to
follow).

Functions (BIFs) could include

get_record(RecordType) -> #RecordType{}
get_record_name(Record) -> RecordType
get_record_fields(RecordName) -> [FieldName1,...]
lookup_record_field(Record, FieldName1) -> Element

Just in time for xmas?? :-)

Regards,
FC
-- 
Francesco Cesarini

Erlang/OTP consultant
Cellular: INT+44-7776 250381 
ECN: 832-707192
http://welcome.to/cesarini.consulting



More information about the erlang-questions mailing list