metaeducation / ren-c

Library for embedding a Rebol interpreter into C codebases
GNU Lesser General Public License v3.0
128 stars 27 forks source link

split-path isn't working #1139

Closed gchiu closed 2 years ago

gchiu commented 2 years ago

R2

>> split-path http://rebol.com/index.html
== [http://rebol.com/ %index.html]

Ren-c

>> split-path http://rebol.com/index.html
** Script Error: at requires series argument to not be null
** Where: all subparse parse split-path args
** Near: [*** index of pos **]
** File: -tmp-boot-
** Line: 4904
hostilefork commented 2 years ago

Fixed here:

https://github.com/metaeducation/ren-c/commit/b57d6ca5806613b03229e79fd196718aeb86aec3

The implementation broke due to a consequence of the stricter rules that no longer treat URL! as a series, to prevent "malformed" (non-LOADable) URL! values.

Previously, in Rebol2:

rebol2>> thing: copy at http://foo.com/bar.txt 16
== bar.txt

rebol2>> type? thing
== url!

There was for a time the thinking we might just find a way to make the non-LOADable things render in a way that could be LOAD-able:

>> thing: copy at http://foo.com/bar.txt 16
== #[url! "bar.txt"]

Current thinking is that this isn't any good, and so you must consciously turn URL! into string and back if you aren't going to keep them as URL! currency.

This broke code trying to do positional COPY/PART type things out of URL!, including SPLIT-PATH. The commit approaches it another way.