Record copy with .* notation
The .*
notation to assign records is discouraged.
Before Genero BDL version 3.20, the syntax to copy a record to another record was done with the
.*
notation:LET record2.* = record1.*
Starting with version 3.20, the proper syntax to assign a record to another record defined with
the same
RECORD
structure, or TYPE
, is to use the record variable
names without the .*
suffix:LET record2 = record1
Important: The
.*
notation to assign records is still supported for
backward compatibility, to be able to compile legacy code. There is no need to change existing code.
Use the new syntax without .*
in new development.The new syntax without of the .*
syntax has mainly been introduced for the
following reason:
When the compiler sees record.*
as function parameter, this is equivalent to list all members of
the record: record.first-element, ...,
record.last-member
.
For example, the next statements are
equivalent:
CALL func1(record.*)
CALL func2(record.field1, ..., record.fieldN) -- not nice, but legal
Genero
3.20 has introduced record types with methods, and
records can be passed as read-only parameters without the .*
notation. In this
case, the compiler makes a stronger type checking for method
parameters:CALL var.method1(record) -- OK if method1 is defined with that record type
CALL var.method1(record.*) -- Denied!
CALL var.method1(record.field1, ..., record.fieldN) -- Denied!