```python def f(x: i32) -> i32: x = 2 return x * x print(f(3)) # => 4 ``` Currently this is allowed: ```console $ lpython a.py 4 ``` But we should give a compile time error message "input parameter `x` cannot be assigned to"
Activity
certik commentedon May 11, 2023
For a comparison, in Fortran this:
is not allowed:
ubaidsk commentedon May 13, 2023
It seems that the example
works in
cpython.Also, I think assignment to function parameter is allowed in
C/CPP, for example:Thus, it seems assignment to function parameter could be allowed in
lpython.ubaidsk commentedon May 13, 2023
I shared a concern here #1803 (comment).