crystal-community / icr

Interactive console for Crystal programming language
MIT License
505 stars 40 forks source link

dynamic constant assignment #51

Closed coderhs closed 7 years ago

coderhs commented 7 years ago

I am unable to declare a constant inside ICR. I am getting this error.

TRANSACTION = 0
dynamic constant assignment

      TRANSACTION = 0

when I ran it in a file, i got the output and all went well.

greyblake commented 7 years ago

Thanks for the bug report.

Yeap, it make sense, and has to be fixed.

/tmp$ icr --debug
icr(0.22.0) > TRANSACTION = 0

========================= ICR FILE BEGIN ==========================
def __icr_exec__
  TRANSACTION = 0
end

puts "|||YIH22hSkVQN|||#{__icr_exec__.inspect}"
========================== ICR FILE END ============================

dynamic constant assignment

  TRANSACTION = 0