Record comprehension

Ulf Wiger <>
Thu Jul 13 11:51:23 CEST 2000


On 13 Jul 2000, Kent Boortz wrote:

>
>>>Well, that would be because a record is really just a tuple with the name of
>>>the record type as the first member. Thus
>>>#tester{first=first,second=second,third=third} is really just
>>>{tester,first,second,third}. Though I'm a little surprised that the lookup
>>>of H#tester.second didn't cause a runtime error due to H not being the right
>>>kind of record.
>>
>> Yes, it is a bit surprising.
>> I believe the main reason is that testing whether a variable is
>> actually of the proper record type requires type analysis, which is
>> something the current compiler doesn't do. For all other types, the
>> runtime system will perform basic type checks, but since there is no
>> record type, the runtime system can't do much.
>
[...]
>
>Changing this behaviour now may break existing code that by mistake or
>intentionally use this misfeature ;-)
>
>kent

... as well as add significant overhead to existing code, which 
assumes that the record selector has practically zero overhead.

I believe a real record type is the solution.
There are several issues to address, mainly the historical use of
records as tuples (which is sometimes very useful.) But I'd accept
code breakage as long as the unpure solutions can be handled 
otherwise, and we solve the problem once and for all.

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Network Architecture & Product Strategies    mob: +46 70 519 81 95
Ericsson Telecom AB,              Datacom Networks and IP Services
Varuvägen 9, Älvsjö,                    S-126 25 Stockholm, Sweden




More information about the erlang-questions mailing list