gijit / gi

gijit is a just-in-time trace-compiled golang REPL. Standing on the shoulders of giants (GopherJS and LuaJIT).
Other
320 stars 17 forks source link

instantiating time.Time struct fails #50

Closed glycerine closed 5 years ago

glycerine commented 5 years ago
gi> import "time"

elapsed: '277.3µs'
gi> var t time.Time
error! __errHandlerForEval sees err =   [string "..."]:8: attempt to call field 'ptrToNewlyConstructed' (a nil value)
[string "..."]:8: attempt to call field 'ptrToNewlyConstructed' (a nil value)
stack traceback:
    [string "--..."]:3262: in function 'ptrToNewlyConstructed'
    [string "..."]:8: in function 'chunk'
    [string "--..."]:3290: in function <[string "--..."]:3290>
    [C]: in function 'xpcall'
    [string "--..."]:3290: in function '__gijitMainEval'
    [string "--..."]:3322: in function <[string "--..."]:3322>

elapsed: '278.509µs'
gi>
glycerine commented 5 years ago

related, can't embed Go structs like time.Time inside Lua structs:

gi> type S struct { t time.Time }

elapsed: '306.963µs'
gi> var s S
error! __errHandlerForEval sees err =   [string "--..."]:2788: attempt to concatenate field 'id' (a nil value)
[string "--..."]:2788: attempt to concatenate field 'id' (a nil value)
stack traceback:
    [string "--..."]:3262: in function '__concat'
    [string "--..."]:2788: in function 'fun'
    [string "--..."]:555: in function '__mapAndJoinStrings'
    [string "--..."]:2793: in function '__structType'
    [string "..."]:2: in function 'chunk'
    [string "--..."]:3290: in function <[string "--..."]:3290>
    [C]: in function 'xpcall'
    [string "--..."]:3290: in function '__gijitMainEval'
    [string "--..."]:3322: in function <[string "--..."]:3322>

elapsed: '185.362µs'
gi>
glycerine commented 5 years ago

fixed in v1.9.5