# Implicit Capture In PARSE - How To Get It?

**URL:** <https://revolt.metaeducation.com/forum/t/implicit-capture-in-parse-how-to-get-it/1718>\
**Category:** Parsing\
**Created:** [September 15, 2021, 4:40pm UTC](https://revolt.metaeducation.com/forum/t/implicit-capture-in-parse-how-to-get-it/1718 "2021-09-15T16:40:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [September 15, 2021, 4:40pm UTC](https://revolt.metaeducation.com/forum/t/implicit-capture-in-parse-how-to-get-it/1718/1 "2021-09-15T16:40:51Z")

</div>

ISO-8601 dates are very close to Rebol dates, but just different enough to make it a pain.

```
; ISO-8601
2021-09-15T12:20:53-04:00

; Rebol
15-Sep-2021/12:20:53-04:00

```

Are Rebol dates more readable? Yes. Are they so much better as to make it worthwhile to buck the standard? 🤷‍♂️ Are they in conflict with generalized PATH! representation? 🤷‍♂️

## Nevermind, This Post Is About Something Else

Let's say I just want to capture the YEAR, the MONTH, and the DAY out of an ISO-8601 date.

```
parse isodate [
    year: between <here> "-"
    month: between <here> "-"
    day: between <here> "T"
    ...
 ]

```

Despite having BETWEEN, it's laborious. _(Historical Rebol needs `copy to "-"` followed by a SKIP, even more convoluted, and worse if you need to skip more than one series item)._

It needs a shorthand. We have TAG! at our disposal, still:

```
parse isodate [year: <*> "-" month: <*> "-" day: <*> "T" ...]

```

And it could be plain **`*`** :

```
parse isodate [year: * "-" month: * "-" day: * "T" ...]

```

But I kind of find myself wishing for another lexical type that means "capture" that has the word "in it". I'd thought about this as being the meaning of `@xxx` before the current interpretation, and also `$xxx`:

```
parse isodate [$year "-" $month "-" $day "T" ...]

```

But almost certainly, $ is going to be binding-related in the default combinator set.

## It Feels Weak To Not Have An Answer For This

Other parsing systems will always seem like they have an edge if there isn't a shorthand for this "capture until the next rule".

But it may be that the default combinators are just too saturated and general-purpose to sacrifice any WORD!-based syntax for such a capture. It might have to be another parameterized parse variation.

---

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [November 9, 2024, 10:47pm UTC](https://revolt.metaeducation.com/forum/t/implicit-capture-in-parse-how-to-get-it/1718/3 "2024-11-09T22:47:42Z")

</div>

> [@hostilefork](#):
>
> I kind of find myself wishing for another lexical type that means "capture" that has the word "in it". I'd thought about this as being the meaning of `@xxx` before the current interpretation, and also `$xxx`:
> 
> ```plaintext
> parse isodate [$year "-" $month "-" $day "T" ...]
> 
> ```
> 
> But almost certainly, $ is going to be binding-related in the default combinator set.

Given that there are more parts in the box, I thought of a possibility for this:

```
parse isodate [:year: "-" :month: "-" :day: "T" ...]

```

It still has a colon on the end, which can help hint that it's an assignment. But the colon on the front gives it a visual sense of balance, pulling it left to where you might imagine it doesn't take any arguments. And it suggests perhaps connecting the left and right in a way that would capture between it.

It's generalized to where you can put tuples inside it:

```
parse isodate [:date.year: "-" :date.month: "-" :date.day: "T" ...]

```

It's certainly _weird_, but it's the best idea I've had so far. Beyond just "`$year` and `@year` are taken", I actually think it's superior.
