koka-lang / koka

Koka language compiler and interpreter
http://koka-lang.org
Other
3.3k stars 167 forks source link

REPL: reload doesn't respond but load does. #208

Open philderbeast opened 3 years ago

philderbeast commented 3 years ago

In the REPL is reload not the same command as load but for remembering the module or file name last loaded? Here after an internal compiler error, reload doesn't respond well but load does.

koka latlng --library --prompt
 _         _
| |       | |
| | _ ___ | | _ __ _
| |/ / _ \| |/ / _' |  welcome to the koka interactive compiler
|   ( (_) |   ( (_| |  version 2.3.2, Oct 15 2021, libc x64 (clang)
|_|\_\___/|_|\_\__,_|  type :? for help, and :q to quit

loading: std/core
loading: std/core/types
loading: std/core/hnd

compile: latlng.kk
loading: std/core
loading: std/core/types
loading: std/core/hnd
compile: units/convert.kk
loading: std/num/double
loading: std/text/parse
loading: std/num/int32
check  : units/convert
compile: units/dms.kk
loading: std/num/int64
check  : units/dms
check  : latlng
*** internal compiler error: Kind.Infer.resolve data def: unknown type: rad

> :r

> :l latlng.kk
compile: latlng.kk
loading: std/core
loading: std/core/types
loading: std/core/hnd
loading: units/convert
loading: units/dms
Core.Parse.envQualify: unable to expand name: units/convert/deg: []
Core.Parse.envQualify: unable to expand name: units/convert/rad: []
Core.Parse.envQualify: unable to expand name: units/convert/deg: []
Core.Parse.envQualify: unable to expand name: units/convert/deg: []
Core.Parse.envQualify: unable to expand name: units/convert/rad: []
Core.Parse.envQualify: unable to expand name: units/convert/rad: []
loading: std/num/double
loading: std/text/parse
loading: std/num/int32
check  : latlng
latlng.kk(11,10): error: types do not match
  context      :          lat'.show
  term         :          lat'
  inferred type: units/dms/dms
  expected type: latlng
philderbeast commented 3 years ago

I see from the help that reload reloads modules. Here I only explicitly loaded one, didn't I (from the command line arguments)?

  :l[oad]     {modulename}  load module(s)
  :r[eload]                 reload the current module(s)
daanx commented 3 years ago

Hmm, right. I think reload only reloads the last successful load.. that seems not quite right though and I guess it should be changed to reload the latest module that was found with a load command (regardless whether it parses and typechecks). I'll think about it.