DESTRUCTURE Dialect

So DESTRUCTURE was a victim of the new policy of extracting unbound structural data by default, and stopped working:

How to Capture Binding Of PARSE Items

But impressively, changing the above to use a binding operation that runs IN on the current input block made it work! (Calling this *in* temporarily until a name is decided)

   let set-word: *in* set-word!, let rule: *in* block! (
        combinators.(to word! set-word): compose [(set-word) (rule)]
    )
    |
    let pattern: *in* block!, '=>, let branch: *in* block!

The *in* combinator was trivial to write:

combinator [
    return: "Argument binding gotten INSIDE the current input"
        [any-value?]
    parser [action?]
    <local> result'
][
    [^result' remainder]: parser input except e -> [
        return raise e
    ]

    return in state.input unmeta result'
]

And that's all it took. :clap:

This is encouraging, and seeing this work out makes me more comfortable with merging Pure Virtual Binding II sooner rather than later.

2 Likes