That's a good idea, though I'm not so sure about the specifics. I
agree that we need to do something about all the boilerplate involved
in tuple construction, but there's a more general problem. There
should be some sort of syntax for specifying tuples with default slot
values and delegate values, and it should be possible to calculate
these. Maybe something like this:
TUPLE: foo bar baz ;
C: foo
    tuck >r { } like r> set-delegate
    tuck set-foo-bar ;
could be written like this:
TUPLE: foo delegate: [ { } like ] bar ?baz ;
though I'm not exactly sure how parsing for that could go. (I have an
idea, but it'd be difficult.) The thing about making those alternate
constructors <foo*> is that then, for most tuple classes, there would
be two identical constructors <foo> and <foo*>, and this is
unnecessary. Also, it doesn't allow for default values. But maybe a
syntax like the one above is overkill.

Daniel Ehrenberg

On 7/17/07, Eduardo Cavazos <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Earlier today, I proposed some alternative conventions for tuples. Here are
> some constructor words rewritten using the alternative system.
>
> The 8080 vocabulary also benefits according to some rewrites I did. Basically
> anything that is tuple setter intensive should benefit.
>
> Ed
>
> ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> ! inference.backend
>
> TUPLE: inference-error rstate major? ;
>
> ! original:
>
> C: inference-error ( msg rstate important? -- error )
>     [ set-inference-error-major? ] keep
>     [ set-inference-error-rstate ] keep
>     [ set-delegate ] keep ;
>
> ! alternative:
>
> : <inference-error> ( msg rstate important? -- error )
> <inference-error*> swap set-delegate ;
>
> ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> ! parser
>
> TUPLE: parse-error file line col text ;
>
> ! original:
>
> C: parse-error ( msg -- error )
>     file get over set-parse-error-file
>     lexer get lexer-line over set-parse-error-line
>     lexer get lexer-column over set-parse-error-col
>     lexer get line-text over set-parse-error-text
>     [ set-delegate ] keep ;
>
> ! alternative:
>
> : <parse-error> ( msg -- error )
> >r
> file get
> lexer get lexer-line
> lexer get lexer-column
> lexer get line-text
> <parser-error*>
> r> set-delegate ;
>
> ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> ! ui.commands
>
> TUPLE: command-map blurb;
>
> ! original:
>
> C: command-map ( blurb commands -- command-map )
>     swap { } like over set-delegate
>     [ set-command-map-blurb ] keep ;
>
> ! alternative:
>
> : <command-map> ( blurb commands -- command-map )
> >r <command-map*> r> { } like set-delegate ;
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to