Skip to content

Instantly share code, notes, and snippets.

@anttih
Created December 12, 2010 12:36

Revisions

  1. anttih created this gist Dec 12, 2010.
    24 changes: 24 additions & 0 deletions gistfile1.io
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # I'd like the inner object's methods to have access to Module's `inside` slot.
    # The new lexicalDo won't cut it since the proto is long gone when the
    # block/method gets called.

    Module := Object clone do(
    inside := 2

    Test := Object clone lexicalDo(
    num := method(inside)
    numblock := block(inside) setIsActivatable(true)
    )

    Another := Object clone
    Another numblock := block(inside) setIsActivatable(true)
    )

    test := Module Test clone
    # neither works
    test num println
    test numblock println

    a := Module Another clone
    # works
    a numblock println