@@ -48,7 +48,7 @@ loop(State) ->
4848 {get_avg , From } ->
4949 From ! State # state .avg , loop ();
5050 {get_values , From } ->
51- From ! State # state .avg , loop (State # state {values = [], avg = 0.0 });
51+ From ! State # state .values , loop (State # state {values = [], avg = 0.0 });
5252 {put_value , Value } ->
5353 Values = [Value | State # state .values ],
5454 loop (State # state {values = Values , avg = lists :sum (Values ) / length (Values )})
5959=====
6060
61611 . Replace most tuple - record usages without having to update anything
62- but the declaration . This includes all of the record syntax ( create ,
63- read , update , match , key index ).
62+ but the declaration . This includes the major parts of the classic
63+ record syntax ( creating , reading , updating , and matching ).
6464
65652 . Create something that is useful in building both APIs and keeping
6666internal state (efficient ).
@@ -79,7 +79,7 @@ The following items will never be considered as goals.
79795 . Supporting `element / 2 ` for native records .
80806 . Supporting opaque records .
81817 . Having `undefined ` as default when neither the record definition nor
82- the record creation provides a value a field .
82+ the record creation provides a value for the field .
83838 . `_ ` wildcard default for assigning a value to any field not explictly
8484 initialized .
8585
@@ -329,8 +329,8 @@ native-record definition is **not** consulted.
329329
330330An access operation fails with a `{badrecord,Expr}` error if:
331331
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
332+ * The definition of the record was not exported when the native-record
333+ value was created , and it is now used outside its definining
334334 module.
335335
336336* `Expr` does not evaluate to a native-record value of the expected
@@ -356,9 +356,8 @@ 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.
359+ * The definition of the record was not exported when the native-record
360+ value was created, and it is now used outside its defining module.
362361
363362### Updating native records
364363
@@ -376,9 +375,8 @@ definition is **not** consulted.
376375
377376An update operation fails with a `{badrecord,Expr}` error if:
378377
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.
378+ * The definition of the record was not exported when the native-record
379+ value was created, and it is now used outside its defining module.
382380
383381An update operation fails with a `{badfield,FN}` error if:
384382
@@ -389,17 +387,17 @@ Native-record update expressions are not allowed in guards.
389387
390388### Anonymous update of native records
391389
392- The following syntax allows update any record having the given fields:
390+ The following syntax allows updating any record that has the given
391+ fields:
393392
394393```erlang
395394Expr#_{Field1=Expr1, ..., FieldN=ExprN}
396395```
397396
398397An update operation fails with a `{badrecord,Expr}` error if:
399398
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.
399+ * The definition of the record was not exported when the native-record
400+ value was created, and it is now used outside its defining module.
403401
404402* `Expr` does not evaluate to a native-record value of the expected
405403 type `#Name` or `#Module:Name` (that is, it is either not a native
@@ -429,9 +427,8 @@ When a native-record value is matched, its native-record definition is
429427
430428Pattern matching fails if:
431429
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.
430+ * The definition of the record was not exported when the native-record
431+ value was created, and it is now used outside its defining module.
435432
436433* The pattern references a FieldK and the native-record value does not
437434 contain this field.
@@ -487,7 +484,7 @@ TODO: What should the name of that BIF be?
487484
488485### Fetching field index
489486
490- Fetching the record index using the `Rec #name.field` syntax is not
487+ Fetching the record index using the `#name.field` syntax is not
491488supported, because there is no way it can actually be used, since neither
492489ETS nor `element/2` will work with native records.
493490
@@ -574,11 +571,11 @@ is_user(U) -> is_record(U, user).
574571
575572### Native records in specs and in the language of types
576573
577- Native records that can be used as types using the following syntax :
574+ Native records can be used as types using the following syntax :
578575
579576```erlang
580577% % local or imported native-record
581- #RecordName { TField :: TType , ... }
578+ #RecordName ( TField :: TType , ... )
582579% % remote native-record
583580#Module :RecordName (TVar1 , ..., TVarN )
584581```
@@ -624,7 +621,7 @@ Native records can be documented just as functions/types/callbacks can be docume
624621If you export a record it will be visible and you have to add `- doc false .`
625622for it to not be shown .
626623
627- If in a spec , type , callback , or native record refers to an undocumented
624+ If a spec , type , callback , or native record refers to an undocumented
628625local native record , the compiler will issue a warning .
629626
630627### Compatibility between OTP 28 and OTP 29
@@ -653,10 +650,9 @@ number()
653650```
654651
655652Native - record values are ordered by their fully qualified name , then
656- by their visibility , then their keys , and finally by field values
657- (field values are considered as maps ). Equality is defined through
658- equality of all the properties : names , visibility , keys and field
659- values .
653+ by their visibility , then by their keys , and finally by field values .
654+ Equality is defined through equality of all the properties : name ,
655+ visibility , keys , and field values .
660656
661657### Reflection
662658
0 commit comments