Skip to content

Commit 997a60f

Browse files
committed
fixup! Add EEP for native records
1 parent eef8179 commit 997a60f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

eeps/eep-0079.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,18 @@ Expr#Module:Name.Field
327327
These expressions return the value of the specified field of the
328328
native-record value.
329329
330-
An access operation fails with a `badfield` error if:
330+
An access operation fails with a `{badrecord,Expr}` error if:
331331
332332
* The native-record value is not visible at the call site (the
333333
native record is not exported and is used outside of the defining
334334
module).
335335
336+
* `Expr` does not evaluate to a native-record value of the expected
337+
type `#Name` or `#Module:Name` (that is, it is either not a native record
338+
at all or it is some other term).
339+
340+
An access operation fails with a `{badfield,Field}` error if:
341+
336342
* The field `Field` is not defined in the native-record value.
337343
338344
The expression can be used in guards — a guard would fail if the
@@ -346,6 +352,10 @@ The following syntax allows accessing field `Field` in any record:
346352
Expr#_.Field
347353
```
348354
355+
This access operation fails with a `{badfield,Field}` error if:
356+
357+
* The field `Field` is not defined in the native-record value.
358+
349359
### Updating native records
350360
351361
The syntax for updating native-record values:
@@ -378,6 +388,10 @@ The following syntax allows update any record having the given fields:
378388
```erlang
379389
Expr#_{Field1=Expr1, ..., FieldN=ExprN}
380390
```
391+
An anonymous update operation fails with a `{badfield,FN}` error if:
392+
393+
* The native-record update expression references the field FN which is
394+
not defined (in the structure definition).
381395
382396
### Pattern matching over native records
383397

0 commit comments

Comments
 (0)