You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I mean by that is that if dtype is not specified, then it will use the same dtype as CPython (I think it's float64).
Consequently, this x: i32[4, 5, 2] = empty([4, 5, 2]) must fail, because the RHS is f64 and the LHS is i32.
The issue is that if we don't do that, then the above code has different types in CPython and LPython, so LPython behaves differently, which is breaching our contract that if LPython compiles the code (and runs), then CPython will behave 100% the same.
Reacted by Smit Lunagariya, Ubaid Shaikh and Thirumalai Shaktivel
Activity
ubaidsk commentedon May 12, 2023
I think we can enforce it. In
CPython, I think it is optional.certik commentedon May 12, 2023
What I mean by that is that if dtype is not specified, then it will use the same dtype as CPython (I think it's float64).
Consequently, this
x: i32[4, 5, 2] = empty([4, 5, 2])must fail, because the RHS is f64 and the LHS is i32.The issue is that if we don't do that, then the above code has different types in CPython and LPython, so LPython behaves differently, which is breaching our contract that if LPython compiles the code (and runs), then CPython will behave 100% the same.
certik commentedon Aug 2, 2023
I am assigning this to @czgdp1807, since he implemented #2118 for i8, so it just needs to be extended for all dtypes.