[comp.lang.icon] user-defined control structures; limitation expressions

goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz) (07/25/90)

Mixed in with a recent posting on another topic, I suggested
that p{a,b,c...} might possibly be extended to p{a;b;c}, where
; is actually intended to represent a comma, semicolon, or new-
line.  This would permit the creation of user-defined control
structures that *looked* like control structures.  I.e. instead
of p{a,b,c} you could just write

    p {
        a
        b
        c
        etc.
    }

This just looks to me like a control structure.  In the case of
my list scanning routines, it would permit me to say -

    l_scan(l) {
        junk1
        junk2
        etc.
    }

The procedure l_scan would set up l_POS and l_SUBJ (the list equiva-
lents to &pos and &subject), and then return a control procedure
(call it setup_scan).  Setup_scan(lst[]) would then simply execute
each of its args, noting whether they were a break or next or some
other control structure that might necessitate ending the scanning
operation.  If encountered, l_POS and l_SUBJ could be restored cor-
rectly, and the loop could be terminated, just as with regular
string scans.

I've got another idea I'd be interested in hearing ideas about.
Why not let &null limiters work like no limiters at all?  Just
curious.  Often I change the amount of backtracking on the fly,
and I find it rather awkward to use backslashes and what not to
try to find a way to get a \ expression to do no limitation at
all.  Is there some easy and elegant way I'm overlooking?

    -Richard L. Goerwitz              goer%sophist@uchicago.bitnet
    goer@sophist.uchicago.edu         rutgers!oddjob!gide!sophist!goer