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

maps with pointers to structs #52

Open glycerine opened 5 years ago

glycerine commented 5 years ago
gi> type T struct { str string }

elapsed: '113.138µs'
gi> a:=make(map[int]*T)

elapsed: '80.073µs'
gi> var t T

elapsed: '141.19µs'
gi> a[3]=&t
error! __errHandlerForEval sees err =   [string "--..."]:1297: attempt to index local 'x' (a string value)
[string "--..."]:1297: attempt to index local 'x' (a string value)
stack traceback:
    [string "--..."]:3262: in function '__newindex'
    [string "--..."]:1297: in function 'keyFor'
    [string "--..."]:2475: in function '__newindex'
    [string "..."]:4: 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: '240.053µs'
gi>