Hi Phil,

Daniel Ehrenberg proposed a similar change to tuple syntax. His code is 
in extra/tuple-syntax, but it only handles the parser side, not the 
prettyprinter.

The reason the prettyprinting for hashtables and vectors is overriden is 
that they are tuples too!

In any case, I'm going to change the core syntax soon, because having 
slot names makes more sense, especially since soon we're adding inheritance.

In the mean time, you can also use the 'describe' and 'inspect' words.

Have fun,

Slava

Phil Dawes wrote:
> 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
>
>   


-------------------------------------------------------------------------
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

Reply via email to