Hi Factor people,
I'm teaching myself how the factor compiler works, and found it helpful
to prettyprint tuples with the slot names in, so I wrote this: (get
ready to gag:)
USING: tuples prettyprint.backend prettyprint.sections classes ;
: my-pprint-tuple ( tuple -- )
t <inset
[ class dup word-name "T{=== " " ====" pprint-string ] keep
dup delegate [ <colon "delegate:" text pprint* hard line-break block>
] when*
[ class "slot-names" word-prop ] keep
tuple-slots [ <colon swap ":" append text pprint* block> hard
line-break ] 2each
"}" text
block> ;
M: tuple pprint* my-pprint-tuple ;
The only problem is that it seems to override the vector and hash
pretty-printers. I can't see where these are defined and was wondering
if there's a way to not override them?
(no big deal if not, just interested)
Thanks,
Phil
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk