diff options
author | Hans Bolinder <[email protected]> | 2015-11-30 09:26:16 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-02-17 12:58:19 +0100 |
commit | de9012628a6b0e97d2f1325bf2f72817f69f84ee (patch) | |
tree | 02a0ca2bff542fd5882d60f16e92b780d5599da1 /lib/eldap | |
parent | 05a24fed7539f861c7d725829acb196a3991923c (diff) | |
download | otp-de9012628a6b0e97d2f1325bf2f72817f69f84ee.tar.gz otp-de9012628a6b0e97d2f1325bf2f72817f69f84ee.tar.bz2 otp-de9012628a6b0e97d2f1325bf2f72817f69f84ee.zip |
stdlib: Modify the preprocessor as to expose typed record fields
Problem: The types of record fields have since R12B been put in a
separate form by epp:parse_file(), leaving the record declaration form
untyped. The separate form, however, does not follow the syntax of
type declarations, and parse transforms inspecting -type() attributes
need to know about the special syntax. Since the compiler stores the
return value of epp:parse_file() as debug information in the abstract
code chunk ("Abst" or 'abstract_code'), tools too need to know about
the special syntax, if they inspect -type() attributes in abstract
code.
Solution: As of this commit no separate form is created by
epp:parse_file(), but the type information kept in the record fields.
This means that all parse transforms and all tools inspecting
-record() declarations need to recognize {typed_record_field, Field,
Type}.
We recommend that all parse transforms and tools be updated as to
recognize typed record fields.
Discussion: As of OTP 19.0, the abstract form of type declarations and
function specifications is documented. An (unsatisfactory) alternative
to the above solution is to document two formats of the abstract form
of typed record fields: one if returned by epp:parse_file(); and one
if returned by, for example, epp:parse_erl_form(). Yet another (bad)
alternative is to not document the format returned by epp:erl_parse(),
but instead document the idempotent function
epp:restore_typed_record_fields/1, and urge authors of parse transform
and tools to always call this function.
Diffstat (limited to 'lib/eldap')
0 files changed, 0 insertions, 0 deletions