Introspection

Getting an object's slot names

slotNames does the trick, although it only shows the object's local slots, rather than all the slots the object has access to.

someObject slotNames sort println

In some cases, this doesn't have the desired effect (e.g. when using slotNames on numbers or strings. In that case, call slotNames on the first proto:

"hello" proto slotNames sort println

Getting the local variables inside a method

(Or anywhere else for that matter... I think?) Use thisLocalContext:

d := "I am a global... sort of"

A := Object clone
A foo := "bar"
A x := method(a, b,
    c := Object clone

    # these seem to do the trick... not sure what the difference is:
    writeln(thisLocalContext)
    writeln(thisContext)
)

A x(1,2)

Sample output:

Object_0x714c98 do(
  appendProto(Object_0x4d9208)
  call := Call_0x714d10
  a := 1
  b := 2
  c := Object_0x70ee10
  updateSlot := CFunction_0x494948
  self := Object_0x70be18
)