Hi Mark,

One other comment, you mentioned not knowing yet how to define tuple
classes in custom syntax.  Here's an approach to learning how parts of
Factor like that work.

1) You can see how TUPLE: is defined:

    IN: scratchpad \ TUPLE: see
    USING: classes.tuple classes.tuple.parser ;
    IN: syntax
    SYNTAX: TUPLE: parse-tuple-definition define-tuple-class ;

2) In the listener, you can click around definitions and see how they work,
but there is a neat feature called annotations that let you watch words
when they are called for their inputs and outputs:

    IN: scratchpad \ define-tuple-class watch

    IN: scratchpad TUPLE: foo a b c ;
    --- Entering define-tuple-class
    class      foo
    superclass tuple
    slots      { "a" "b" "c" }
    --- Leaving define-tuple-class

The tuple definitions support types and initial values, for example this:

    TUPLE: bar
        { a fixnum }
        { b string initial: "hello" }
        { c byte-array } ;

In this case, the "slots" looks like this:

    {
        { "a" fixnum }
        { "b" string initial: "hello" }
        { "c" byte-array }
    }

And you can click on the values that are displayed from the annotation to
introspect more complicated objects, or ones that are displayed in a
compact format such as "{ ~array~ ~array~ }"

Best,
John.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to