simple icon indicating copy to clipboard operation
simple copied to clipboard

final variable initialized as null does not allow re initialization to real value

Open Thecarisma opened this issue 7 years ago • 2 comments

Following initailization of a final variable to null the variable should be able to allow initialization once more to real value instead of throwing Cannot assign a value to the final variable error. Example :

final variable = null
variable = true #throws an error, it should not

Thecarisma avatar Dec 31 '18 09:12 Thecarisma

Eh, well. I think a final variable should be defined with whatever it should be allocated to.

Youngestdev avatar Dec 31 '18 09:12 Youngestdev

Some time the initialization might be required to occur in a constructor or method such as

class TClass

final variable = null

block TClass(param)
    variable = param #throw error it should not occur

Although the approach below work

class TClass

final variable 

block TClass(param)
    variable = param #no error

but sometime people can default to the above therefore the behavior should be the same. null is currently an empty string which might be what is confusing the vm I ll open an issue for the null to be a true NULL pointer

Thecarisma avatar Dec 31 '18 09:12 Thecarisma