Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Missing implicit unroll on member ptr assignment. #189

@travisdoor

Description

@travisdoor

Currently we cannot assign structure member directly with unrolled return value members, this is super annoying in case we introduce error handling, where we kinda expect the error value go to right catch block and other values go to the left. We should allow automatic unroll at least for functions returning two values, where error value should be "consumed" by catch block, leaving the rest for left-side expression.

foo :: fn () (s32, Error) {
	return 1, OK;
}

Data :: struct {
	a: s32;
}

main :: fn () s32 {
	data: Data;
	data.a = foo() catch panic($); // We have to use local temporary variable here.
	return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions