metaeducation/ren-c

Parse not returning matched position

rgchris opened this issue · 2 comments

Expected behaviour:

>> parse [a b c] [some word! mk:]
== []

Actual behaviour:

>> parse [a b c] [some word! mk:]
== [a b c]

Tested:
Ren Garden, Version: 2.102.0.16.1, Build: 24-Nov-2020/22:56:39+0:00

Weighing the pros and cons made me believe that defaulting to requiring reaching the END--the historical behavior--was likely the best default. But that requesting how far you progressed would implicitly signal that you need not reach the end, and return that progress amount.

https://forum.rebol.info/t/the-parse-of-progress/1349

The main thing to decide is a syntax for saying you're only interested in the progress, which is something that hasn't been firmed up for multi-returns yet.

Note also that multi-returns can be interacted with via passing words conventionally:

>> parse/progress "abc" ["ab"] 'pos
== "abc"

>> pos
== "c"