The following code is like the Builder example from Io Day 3. However, instead of printing HTML it prints information about the call. I can’t figure out why the “CONTENT” lines are printed twice.
The code:
Builder := Object clone Builder forward := method( writeln("\nMESSAGE_NAME = ", call message name) writeln( "MESSAGE = ", call message) writeln( "NARGS = ", call message arguments size) call message arguments foreach(arg, writeln("\n ARG = ", arg) writeln( " ARG type = ", arg type) content := self doMessage(arg) writeln(" CONTENT = ", content) ) ) b := Builder clone b ul( li("Io"), li("Lua") )
The output:
MESSAGE_NAME = ul MESSAGE = ul(li("Io"), li("Lua")) NARGS = 2 ARG = li("Io") ARG type = Message MESSAGE_NAME = li MESSAGE = li("Io") NARGS = 1 ARG = "Io" ARG type = Message CONTENT = Io CONTENT = nil ARG = li("Lua") ARG type = Message MESSAGE_NAME = li MESSAGE = li("Lua") NARGS = 1 ARG = "Lua" ARG type = Message CONTENT = Lua CONTENT = nil