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
Certainly not a bug but coming from other programming languages it feels buggy that this snippet
type Foo = object
port* : Natural = 6789
let f = Foo()
echo "f.port:", f.port
proc someStuff() : Foo =
echo "result.port:" , result.port
result = Foo()
echo "result after build.port:" , result.port
let sf = someStuff()
echo "sf.port:", sf.port
outputs
f.port:6789
result.port:0
result after build.port:6789
sf.port:6789
IMO it is both error proning and not consistent...
what is the rationale, is there any magic compilation flag to have field initialization done 'ever ever' ?
Thanks.
Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Nim Version
2.2
Description
Certainly not a bug but coming from other programming languages it feels buggy that this snippet
outputs
f.port:6789
result.port:0
result after build.port:6789
sf.port:6789
IMO it is both error proning and not consistent...
what is the rationale, is there any magic compilation flag to have field initialization done 'ever ever' ?
Thanks.
Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: