Request: Useful Symbol.toString() functionality

Currently, if you print out a Symbol, you get the incredibly helpful "symbol" string.

This makes their use problematic because if your app is passing them around and you need to add some debugging later to figure out the current-state of the app, you're pretty much SOL.

Ruby handles this well, by making the `to_s` method print out a proper string representation of the symbol.

I understand that the point of Symbols is that they're lightweight, so keeping a string mapping table would sort of defeat the purpose. But I'm wondering if we could provide this helpful mapping in debug versions of the app?

e.g.

var = :foo;

System.println(var); // Prints "foo" in debug version, print "symbol" in production versions
  • I'm guessing, but I think it's because the symbol table isn't included in a non-debug build.

    Monkey C is compiled (probably into byte codes), and I believe Ruby is interpretative, and when compiled into a non-debug version mc can leave off a whole bunch of stuff, and make the resulting .prg much smaller.
  • I'm guessing, but I think it's because the symbol table isn't included in a non-debug build.

    Monkey C is compiled (probably into byte codes), and I believe Ruby is interpretative, and when compiled into a non-debug version mc can leave off a while bunch of stuff, and make the resulting .prg much smaller.


    Yeah it makes sense for production builds to be lean-and-mean, but I'm not seeing useful Symbol.toString() values even in a debug build. I'm leaning towards ripping out any of use of them because their lightweight-ness isn't worth the trade-off in the opaqueness that they currently have...