The following code doesn't (always) crash in R3-Alpha:
>> parse "" [quote ()]
== false
However, what it is doing is accessing the string input as if it were an "any block" (a.k.a. ARRAY) for a comparison, which is an invalid interpretation of the bits:
That's a bug (Ren-C is noisy enough to notice, R3-Alpha isn't and just maybe crashes, maybe returns false). But what is the desired behavior? Note that it is illegal to use other arbitrary values as source for a parse rule:
>> parse "a" ['a]
** Script error: PARSE - invalid rule or usage of rule: 'a
** Where: parse
** Near: parse "a" ['a]
This should give the same output:
>> parse "a" [quote a]
And so should this:
>> parse "a" [quote ('a)]
Other operations that are not designed for use on string series avoid such behavior by checking first to make sure the input is not a string, and if it is jump to bad_rule:
Submitted by: Hostilefork
The following code doesn't (always) crash in R3-Alpha:
However, what it is doing is accessing the string input as if it were an "any block" (a.k.a. ARRAY) for a comparison, which is an invalid interpretation of the bits:
https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/core/u-parse.c#L899
That's a bug (Ren-C is noisy enough to notice, R3-Alpha isn't and just maybe crashes, maybe returns false). But what is the desired behavior? Note that it is illegal to use other arbitrary values as source for a parse rule:
This should give the same output:
And so should this:
Other operations that are not designed for use on string series avoid such behavior by checking first to make sure the input is not a string, and if it is jump to
bad_rule
:https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/core/u-parse.c#L915
That's an easy fix for this case, but it rules out the ability to quote strings, which one might imagine being legal.
For the moment Ren-C disallows QUOTE when the input is a string series.
Imported from: https://github.com/rebol/rebol-issues/issues/2253
Comments: