Skip to content

`x <?= y` should return `x` when `x <= y` #178

Closed
copygirl opened this Issue Oct 15, 2012 · 4 comments

3 participants

@copygirl

(was x <?= y not the same as x = x <? y)

I'm not quite sure what exactly is going on here, but I expected these two to behave the same.

@satyr
Owner
satyr commented Oct 15, 2012

x gets the lower value in both cases. The compound version is compiled so that the assignment only happens when necessary (just like x ||= y compiles to x || (x = y) rather than x = x || y).

@copygirl
x = 0
y = Math.random! * 10 - 5
x <?= y

always returns y.

x = x <? y on the other hand only returns y when it's smaller than 0.

@vendethiel

x <?= y will return y, but assigns x correctly.

@satyr
Owner
satyr commented Oct 15, 2012

Oh, the return value. Yup, that's a bug.

@satyr satyr added a commit that closed this issue Oct 15, 2012
@satyr fixed #178 7330542
@satyr satyr closed this in 7330542 Oct 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.