Skip to content

Documentation: Misleading statement about passing behavior of immutables #23127

@jrklasen

Description

@jrklasen

The following statement seems wrong ('Documentation / Type / Mutable Composite Types'):

  • An object with an immutable type is passed around (both in assignment statements and in function calls) by copying, whereas a mutable type is passed around by reference.

This reads to me as if values are copied, which seems not to be the case. See 'Documentation / Functions / Argument Passing Behavior':

Julia function arguments follow a convention sometimes called "pass-by-sharing", which means that values are not copied when they are passed to functions. Function arguments themselves act as new variable bindings (new locations that can refer to values), but the values they refer to are identical to the passed values.

Edit: removed misleading example

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsThis change adds or pertains to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions