Skip to content

Assigning to a numbered parameter in lambda is expected to result in an error #5605

Description

@dearblue
% bin/mruby -e 'p ->(_1, _2) { _3 = 1 }'
#<Proc:0x8007c50a0@-e:1 (lambda)>

% bin/mruby -e 'p proc { |_1, _2| _3 = 1 }'
-e:1:12: formal argument cannot be a numbered parameter
-e:1:16: formal argument cannot be a numbered parameter
-e:1:22: can't assign to numbered parameter

% ruby31 -e 'p ->(_1, _2) { _3 = 1 }'
-e:1: _1 is reserved for numbered parameter
-e:1: _2 is reserved for numbered parameter
-e:1: _3 is reserved for numbered parameter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions