@@ -297,12 +297,9 @@ from the current native-record definition, namely:
297297
298298* Whether it is exported (through `-export_record`)
299299
300- The runtime needs the current native-record definition to perform
301- create and update operations.
302-
303- However, to perform read operations on native-record values — accessing
304- native-record fields and pattern matching over native-record values —
305- the runtime does not consult the current native-record definition.
300+ The runtime needs the current native-record definition to create a
301+ record. It does not use native-record definition when updating or
302+ reading values from a record.
306303
307304To minimize the ambiguity of the next sections we would use more verbose wording:
308305
@@ -327,15 +324,18 @@ Expr#Module:Name.Field
327324These expressions return the value of the specified field of the
328325native-record value.
329326
327+ When a field from a native-record value is accessed, the native-record
328+ definition is **not** consulted.
329+
330330An access operation fails with a `{badrecord,Expr}` error if:
331331
332- * The native-record value is not visible at the call site ( the
333- native record is not exported and is used outside of the defining
334- module) .
332+ * When the native-record value was created, the definition of the
333+ record was not exported, and it is now used outside its definining
334+ module.
335335
336336* `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 ).
337+ type `#Name` or `#Module:Name` (that is, it is either not a native
338+ record at all or it is another native record ).
339339
340340An access operation fails with a `{badfield,Field}` error if:
341341
@@ -356,6 +356,10 @@ This access operation fails with a `{badfield,Field}` error if:
356356
357357* The field `Field` is not defined in the native-record value.
358358
359+ * When the native-record value was created, the definition of the
360+ record was not exported, and it is now used outside its definining
361+ module.
362+
359363### Updating native records
360364
361365The syntax for updating native-record values:
@@ -367,17 +371,19 @@ Expr#Module:Name{Field1=Expr1, ..., FieldN=ExprN}
367371
368372Field names must be atoms.
369373
370- A native-record value is updated according to its native-record definition.
374+ When a native-record value is updated, its native-record definition is
375+ **not** consulted.
371376
372377An update operation fails with a `{badrecord,Expr}` error if:
373378
374- * The native-record definition is not visible at the call site (the
375- native record is not exported from `Module`).
379+ * When the native-record value was created, the definition of the
380+ record was not exported, and it is now used outside its definining
381+ module.
376382
377383An update operation fails with a `{badfield,FN}` error if:
378384
379385* The native-record update expression references the field FN which is
380- not defined (in the structure definition) .
386+ not defined native-record value .
381387
382388Native-record update expressions are not allowed in guards.
383389
@@ -389,6 +395,16 @@ The following syntax allows update any record having the given fields:
389395Expr#_{Field1=Expr1, ..., FieldN=ExprN}
390396```
391397
398+ An update operation fails with a `{badrecord,Expr}` error if:
399+
400+ * When the native-record value was created, the definition of the
401+ record was not exported, and it is now used outside its definining
402+ module.
403+
404+ * `Expr` does not evaluate to a native-record value of the expected
405+ type `#Name` or `#Module:Name` (that is, it is either not a native
406+ record at all or it is another native record).
407+
392408An anonymous update operation fails with a `{badfield,FN}` error if:
393409
394410* The native-record update expression references the field FN which is
@@ -408,11 +424,14 @@ The syntax:
408424
409425Here, `Expr1`, .. `ExprN` are patterns, and Field names must be atoms.
410426
427+ When a native-record value is matched, its native-record definition is
428+ **not** consulted.
429+
411430Pattern matching fails if:
412431
413- * The native-record value is not visible at the call site, that is,
414- an attempt is made to match out a a value from a non-exported record
415- from a module other than its defining module.
432+ * When the native-record value was created, the definition of the
433+ record was not exported, and it is now used outside its definining
434+ module.
416435
417436* The pattern references a FieldK and the native-record value does not
418437 contain this field.
@@ -487,6 +506,11 @@ If `Module` is a module name and `Name` is an atom, the predicate
487506returns true if term `Term` is a native-record value with the
488507corresponding native-record name.
489508
509+ This function will only check that `Term` is a native record with
510+ `Name` created from the given the module. It will not check whether
511+ the native record is still defined in the given module, nor whether
512+ it is exported.
513+
490514Example:
491515
492516```erlang
@@ -517,6 +541,9 @@ an imported native record.
517541If `is_record / 2 ` is used in a function body , `Name ` is allowed to be a
518542variable .
519543
544+ If `Name ` refers to an imported native record , see the description of
545+ `is_record / 3 ` for more details .
546+
520547Examples :
521548
522549```erlang
0 commit comments