RapydScript icon indicating copy to clipboard operation
RapydScript copied to clipboard

Unpack tuple to multiple targets not supported

Open gordianknotC opened this issue 9 years ago • 2 comments

def kproperty(exports):
    exports.L2, exports.L1, exports.L0 = L2, L1, L0  # works

    exports.L2, exports.L1, exports.L0 = L2, L1, L0 = (2, 1, 0) # failed

which generates

function kproperty(exports) {
    var _$rapyd$_Unpack;
    _$rapyd$_Unpack = [L2, L1, L0];
    exports.L2 = _$rapyd$_Unpack[0];
    exports.L1 = _$rapyd$_Unpack[1];
    exports.L0 = _$rapyd$_Unpack[2];

    _$rapyd$_Unpack = [L2, _$rapyd$_Unpack = [2, 1, 0]; 
    L1 = _$rapyd$_Unpack[0];
    L0 = _$rapyd$_Unpack[1]];
    exports.L2 = _$rapyd$_Unpack[0];
    exports.L1 = _$rapyd$_Unpack[1];
    exports.L0 = _$rapyd$_Unpack[2];
}

gordianknotC avatar Mar 26 '15 12:03 gordianknotC

good catch, will investigate this

atsepkov avatar Mar 28 '15 17:03 atsepkov

This is fixed in my fork. https://github.com/kovidgoyal/rapydscript-ng

@atsepkov This is not a single commit as there were many related issues that needed to be fixed. Just look at all commits made today.

kovidgoyal avatar Sep 14 '15 15:09 kovidgoyal