erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.69k stars 55 forks source link

In REPL, redefine the defined variables. If the values are different, the program will crash #72

Closed C-BJ closed 2 years ago

C-BJ commented 2 years ago

image

mtshiba commented 2 years ago

Erg prohibits reassignment of variables, but its error handling does not seem to be working well.

C-BJ commented 2 years ago

Erg prohibits reassignment of variables, but its error handling does not seem to be working well.

If the reassigned value is the same, it will report an error instead of a crash @mtshiba

mtshiba commented 2 years ago

Even if the resulting substituted values are the same, an error is still generated.

if this is OK,

i = 1
i = 1
rand = pyimport "random"
i = 1

i = rand.randint!(0, 1)

There is a one in two chance that this code must be valid. That is nonsense.

That said, this code should be failed with errors normally without crashing.

C-BJ commented 2 years ago

Even if the resulting substituted values are the same, an error is still generated.

if this is OK,

i = 1
i = 1
rand = pyimport "random"
i = 1

i = rand.randint!(0, 1)

There is a one in two chance that this code must be valid. That is nonsense.

That said, this code should be failed with errors normally without crashing.

Yes, But I'm describing the situation @mtshiba

mtshiba commented 2 years ago

Yes, I will fix this unintended behavior soon.

mtshiba commented 2 years ago

The crashing has been fixed, but it still detects extra errors.

スクリーンショット 2022-08-30 221305