wheineman/nrpl

Redefinition of values

andreaferretti opened this issue · 1 comments

This fails

> let x = 25
- 
> let x = 12
- 
> echo x
nrpltmp.nim(3, 5) Error: redefinition of 'x'

In REPLs it is usually understood that newer definitions shadow the old ones.

Scala manages to do this by evaluating each expression in an inner scope. You may do the same by adding a new block for each expression to be evaluated

Hmmm. I'll have to think about this. If it's in the same scope, it's intended that the second declaration replaces the first declaration within the REPL. However, nrpl is not a real REPL and merely a front end to the compiler, and it is a coding error in that context. I'll meditate on this one a bit.