Record tests (was: geometric memory growth)

Bjorn Gustavsson bjorn@REDACTED
Mon Nov 28 09:47:56 CET 2005


"Ulf Wiger (AL/EAB)" <ulf.wiger@REDACTED> writes:

> Specifically for record field access, the reference manual
> doesn't really specify that it should reduce exactly to
> an element/2 call. In the old days, it used to expand
> into a pattern match, if I recall correctly.

No. Access to a single field using the Record#record.field syntax
has always expanded to an element/2 call.

In R10B-8 you can give the 'strict_record_tests' option to the compiler
to have it generate code that verifies that Record is of the proper
type when using Record#record.field in bodies (not in guards, yet).

That option will be probably be the default in R11B.

Currently, if the record test for Record#record.field fails, there will
be a badmatch exception. I hope to fix that to the correct bad_record
exception in a future release, and also to verify records in guards.

/Bjorn
-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list