Polymorphic record question
Hans Bolinder
hans.bolinder@REDACTED
Tue Jun 20 10:08:10 CEST 2006
[Bengt Kleberg:]
> On 2006-06-20 08:17, Andrew Lentvorski wrote:
> > Richard A. O'Keefe wrote:
>
> ...deleted
> >> I'm a little surprised that the "downcasting" hack worked at all,
> >> and I wouldn't expect it to _keep_ working in future releases.
> >
> > Yeah, I was a bit surprised that it worked, too. Presumably the
> > compiler just does a mapping from record field to tuple position number
> > and doesn't bother checking the first field to make sure that the names
> > match.
>
> if you want to discover errors when using records it is best to avoid
> ''.'' to access the members.
When given the option 'strict_record_tests' the compiler will emit
code that checks the record tag as well. See compile(3).
Best regards,
Hans Bolinder, Erlang/OTP
More information about the erlang-questions
mailing list