« first day (3548 days earlier)      last day (232 days later) » 

12:12 AM
I dunno. Tough call.
 
12:53 AM
    >> parse "abbbbbc" ["a" some ["b"]]
    == "c"

    >> parse "abbbbbc" ['a some ['b]]
    == "c"
The latter is lighter; if you consider each individual mark in a quote a "thing", it's like you've gotten rid of six ticks.
It's not as easy to do as I thought at first. There's a type hierarchy, a REBVAL is fully specified, a RELVAL is possibly relative, a REBCEL is a low level view of a QUOTED! cell's bits retyped to know not to ask for its quoted-tweaked type bits -or- possibly a special separate cell in a node escaped if it's 4 levels of quoting or more.
The string routines were thinking in terms of RELVAL and not REBCEL, and it took a bit of doing. Now we have to ask if it should be legal to do parse "..." ['a: ':b '@c ''a '''b '''c] or not, and if it is, what that should mean.
I've made it so a quoted string acts the same as a plain string would. This is nice if you have something you don't know if it's a string or a word but want it to do the same thing, and you're doing a compose or something, you can say compose [blah blah '(my-word-or-maybe-string)] and the tick won't create a problem in the string case.
We should make all quoted strings use the '{...} rendering because '"..." makes it too hard to see the apostrophe.
I really think the LOGIC! true meaning "keep going", as well as NULL meaning "keep going, no comment"... with LOGIC! false mean "fail rule" is a rather great advancement, once you have GROUP!s that don't throw away their results.
 
1:51 AM
@HostileForksaysdonttrustSE An inline bar.
 
>> find "abchellodef" 'hello
== "hellodef"
Over time I've been unifying PARSE and FIND internals, so things work the same.
red>> find "abchel😺lodef" 'hel😺lo
== "hel😺lodef"
Looks like Red permits that as well, seems to work. I don't know if their WORD!s are kept as UTF-8 or if they decode them to fixed size codepoints and go through the same comparison process as strings do.
They do not allow it in PARSE, but given that works they probably wouldn't have a hard time making it legal.
>> parse "abc [d e f] {Hello}" ["abc" set b block! set s text!]
== ""

>> b
== [d e f]

>> s
== {Hello}
@rgchris ^-- that works today through a somewhat hacky experimental mechanism, proof of concept. But we'll have to firm up exactly what the rules are for it.
 
2:49 AM
@HostileForksaysdonttrustSE To clarify, are the spaces somehow consumed by the rules?
 
@rgchris It calls to the scanner and uses the scanners rules, so "whatever transcode/next would do".
e.g. today, parse "123abc" [set i integer!] would not work, because the scanner would not accept it.
>> parse "123 {abc}" [set x integer!]
== " {abc}"
Spaces are consumed on the leading edge but not the trailing one. You have to end with a legal delimiter, of which space is one.
>> parse "123] {abc}" [set x integer!]
== "] {abc}"
But so would be a bracket. In any case, this is just what I could see how to do relatively easily.
We might come up with alternate parameterizations, to tell it to treat other things as delimiters. Like if you're parsing binary data, we could say a #{00} would delimit it. Or we might set a length. I'm not sure, but I think it could be useful.
 
It seems a worthy direction and opens up some interesting possibilities (alternative to LOAD for those that want finer grained controls or a JUNK option.
 
There is a point here somewhere--and I'm not sure where it is--where these things are looked at as "things for the future generations of people working in this medium to worry about". So the key is to start putting together some fun (and possibly practical) applications with what there is.
And get them on the web and in people's hands easily.
 
The spaces would be awkward to problematic, and I think it'd be desirable to test against a rule for each type in a way that I don't the scanner is particularly suited for.
(lest you Parse for parse {{...really long string...}} [integer!])
 
3:04 AM
red>> parse "aaa" [3 collect [keep "a"]]
== [#"a" [#"a"] [#"a"]]

red>> parse "abab" [2 collect [keep "ab"]]
== ["ab" ["ab"]]
 
Uh...
 
@rgchris ^-- repeated rule processing for COLLECT e.g. parse "aaa" [3 collect x [keep "a"]] was giving an error, so I tested to see what Red would do.
Rebol's PARSE really needs some restructuring to handle more interesting rules. Multiply parameterized rules seem to not like repeating.
r3-alpha>> parse "abc" [3 set x char!]
** Script error: PARSE - invalid rule or usage of rule: set
 
I don't know that it's particularly useful to do that—Red's response is awkward and Ren-C's response would, I presume, only set the given COLLECT word the last match.
 
red>> parse "abc" [3 set x skip]
== true

red>> x
== #"c"
r3-alpha>> parse "abc" [3 set x skip]
** Script error: PARSE - invalid rule or usage of rule: set
 
@HostileForksaysdonttrustSE But then I think Red's Parse direction with things like COLLECT is misguided.
 
3:09 AM
@rgchris Probably not that useful. You can put it in a BLOCK!. I just mean that it seems to me that still, the system should be set up so that you can put a single rule anywhere you could put a block.
 
@HostileForksaysdonttrustSE Agreed.
 
There is a mechanical problem with the way R3-Alpha's parse was laid out, and Ren-C has in a way made this mechanical problem worse. But it has infrastructure to make it better...I just see that "making it better" being a modularized PARSE where adding new keywords parallels adding new functions.
So repetitions could come from building a "FRAME!" for a parse step, and that frame could be reused without backtracking in the rules. There is a hard rule in the evaluator of how it can look backwards and forwards, and it can't look back more than one unit.
And it can't look back at all once a step has "completed".
So the way repeated rules are done right now, they can't work for anything with more than one argument.
Which is kind of how it worked before, which is why 3 set x skip didn't work in R3-Alpha, it just has become more set in stone than a kind of "empirical behavior".
Once you've passed SET X SKIP and want to do it again, you're after SKIP, with only one unit of lookback to X.
It's done in kind of the wrong way just generally speaking. But 3 [set x skip] works.
@rgchris If you want to KEEP the by-products of a DO inside of a PARSE, I'm thinking that keep :[1 + 1] with the GET-BLOCK! might be a reasonable syntax. The problem with keep :(...) is that :(...) is used to splice rules-as-rules, so you might want that to be keep :(either flag '[some "a"] '[some "b"]) or the like.
My current targeting of @[...] for datatypes doesn't mean that's the only thing it can do, but in spots where you want to talk about datatypes, that's what it would be.
I think my belief in the inventory was such that I thought you could use :[...] for REDUCE but that seems silly, because if you mean REDUCE you can say :[reduce [a b]], what we really need is a way to generically DO code and not splice it. And I like the idea that (...) are known to always just run and vaporize, so they're never used to pass parameters.
You've always got quoting to match things literally. I like this notion of parse [abc :[value: 3]] ['abc :(quote compose :[value: (1 + 2)])]
But the idea is that these GET-BLOCK!s wouldn't have meaning unless they were parameters to something like KEEP.
So without the QUOTE I imagine that would be an error.
If you wanted to DO code and throw out the result, use a plain GROUP!.
If you wanted to DO code and inject it into the parse stream as a rule, use a GET-GROUP!.
It's things like KEEP that need to make the distinction, of whether you are trying to KEEP the result of a DO or are you trying to keep the result of matching a pattern that was produced by a DO.
 
3:28 AM
I think we diverge in thinking here, but I see the lone vanishing () as the only exception and would rather a preceding keyword to solve the incongruity, if that.
 
keep rule (...)  ; code executed, kept as rule
keep (...)  ; code executed, kept as data

keep data (...)  ; code executed, kept as data
keep (...)  ; code executed, keep treats as rule
@rgchris I personally am bothered by the variance in behavior of (...), there's a certain comfort in my mind to being able to know that there is a visual cue as to whether the product is kept, and the keywords don't do that for me.
Allowing :(...) to mean anywhere it is used "splice product as rule" then it fits in very naturally in this role.
 
I think the more common usage of GROUP! would still be to silently run code, but if such behaviour required an ELIDE or DO, maybe that'd be enough. I think the workarounds are inelegant.
 
Otherwise you need splice (...)
elide only elides one expression, so you'd be (elide (...)) if you had more to say.
 
I was thinking of ELIDE as a Parse keyword.
parse "thing" ['thing elide (do thing)]
 
That feels like it undermines the convenience and brevity.
 
3:35 AM
Yep.
But it adds continuity.
 
I think rule splicing is less common, but I don't feel that ['data splice (if option off [lit 'not]) 'available] has the foundational appeal of ['data :(if option off [lit 'not]) 'available]
What I like about it is that you are seeing a number of "things" that matches the number of "things", the splice keyword pollutes it IMO.
In much the same way that I think the ELIDE pollutes it.
 
I am prepared to retroactively apply the narrative that in historical Rebol, a group's product is discarded unless proceeded by a keyword that uses it.
 
It becomes "off balance", the thing that produces one rule outcome is multiple things.
['data 'not 'available] ... three items in block. ['data :(if option off [lit 'not]) 'available]
There's an appealing symmetry in this to me, and I know you hate all manner of symbols and "tics" but if there is a good use for a colon I like it here as "use the contents".
The R3C you have is at where this was ['data ((if option off [lit 'not])) 'available]
 
I think I'd prefer a preceding keyword.
 
Which at the time, I was using (( )) to mean /ONLY in COMPOSE, so it seemed to make sense... until I decided (( )) semiotically looked like "fatter" and "multiple" so it made more sense to mean splice.
@rgchris We can offer both options, though I both like it less as code and don't like the idea of plain GROUP!s having this "sometimes they vanish and sometimes they don't" character.
I feel like my natural cueing is off if I have to go looking to the left past whitespace to know.
I guess it speaks to one of the design questions of modular parse, because this is the kind of thing I'd sort of like to be able to set up as a ground rule... even to the point that maybe the PARSE plugins never see plain GROUP!s, or GET-GROUP!s, because they are part of the service offered by the parse engine.
You only see the post-spliced and post-vanished world
 
3:47 AM
@HostileForksaysdonttrustSE This does mean that for continuity, you have to use the GET-GROUP! for all operations where you want to use the product. I think I'd keep my above narrative over the alternative.
 
Well let's put a pin in it for now. You're talking about a feature that wasn't available before, so maybe your feelings would be different after using it some. If you want to try it for now, it's (( )) so it's neither.
 
Indeed.
 
I'm wondering if allowing even set x :[1 + 2] should be legal. That might seem dumb on the surface, but only if you don't think of it in a polymorphic way.
e.g. what if it's set x rule and you are doing rule dynamically, where sometimes it goes by a pattern on the input and sometimes it's fixed or generated from another source.
You couldn't do that with a GROUP! or a BLOCK! or a GET-GROUP! in the system I propose, but this is a new concept (motivated by KEEP, not by SET, but same premise)
I'd have to think more broadly about the applications. Could parse [1 2 4] [collect numbers [keep ['1 integer! :[1 + 2] '4]] not be an error, but somehow make the rule match a synthesized input? :-/ No clue how that would work, though [keep ['1 integer!] keep :[1 + 2] keep '4] is very doable.
When I said "set x :[1 + 2] seems dumb on the surface" I meant compared to just (x: 1 + 2)
I feel like keywords for foundational compositional intent just seem like going too much to a one-size-fits-all kind of situation like where you wouldn't need groups as 1 + (a / b) but you could just say 1 + group [a / b] and do it all with blocks.
It might reduce the number of parts in the box, but once you get a little sophisticated you'd kind of like words to be used for the... vocabulary parts, not sort of basics of evaluation.
 
4:15 AM
@rgchris Just curious, assuming you went with my line of thinking do you think that perhaps :[ ] is better for "get rule" as it runs DO code to act more "block-like" in the dialect, and :( ) should be used for "do code and keep do result as non-rule material for argument to a keep/set/etc?"
If you had to live in that world, is it preferable to reverse these two.
keep data :( ) isn't so bad, and it would mean all DO code was in GROUP!s. I dunno. None of this is set in stone, it's new stuff. My main issue is just not liking to see plain GROUP!s not vaporize, I've always wanted some sort of cue for the result being actually used.
There's a definite visual value in having all DO code differentiated by being inside a GROUP! of some kind.
@(...) does not currently have a use, nor does @x or @x/y. I've mentioned the @[...] type likelihood.
@(...) has the advantage of standing out better, and when no keywords are there like keep :(...) where you might take note of the oddity of the colon.
elide looks okay when you don't have a lot of code in groups, but some cases have so much code in GROUP!s, you wind up saying elide on every line, multiple times.
@rgchris parse "aBc" [set x 'Abc]... if type is matched, do you get a spelling matching what you asked for or what was in the data? If it's aBc you will have to create another WORD!. :-/
red>> parse "a" [set x "A"]
== true

red>> x
== #"a"
r3-alpha>> parse "a" [set x "A"]
== true

r3-alpha>> x
== #"a"
There's certainly a danger with set x str if you actually set x to str if it matches, and then change str later you change x. But... well, that's how SET works in the language usually.
 
4:56 AM
    rebol2/r3-alpha>> find "abcd10ef" 10
    == "10ef"

    red>> find "abcd10ef" 10
    == none
I don't know what the right answer is, but... I think if you believe a certain type is unfindable in another type by very design, it should probably be an error to look for it.
I'm looking at a case where literal searching for numbers in a string like that is useful as a parse rule. You could say "10" but '10 has less visual noise and arguably could convey that if you're going to match it, you want an INTEGER! back.
There's ambiguity, because you might be looking for a codepoint with that value... not too likely since you'd use a CHAR! if that's what you meant. But... with BINARY! it's different, because there's no BYTE! type. So the only way to look for a byte is by integer.
Well, or a single-element BINARY! I guess.
rebol2>> find #{0010FF} 16
== none

r3-alpha/red>> find #{0010FF} 16
== #{10FF}
 
 
9 hours later…
2:05 PM
@HostileForksaysdonttrustSE What is the cost of that vs. a BYTE! type?
 
@rgchris Series node, (8 x sizeof(platform pointer)) plus GC overhead. It would technically be possible to rig up a form of single-element BINARY! that was immutable and cost no more than a cell... I'm planning some mechanisms of this type to make immutable single element blocks/paths/groups/etc. in order that single element paths like /foo will cost no more than a refinement! did.
 
I know that Red has the 100h notation that is just an alternative form of INTEGER! and could conceivably be a separate type (preferably with different notation).
 
make-byte 16 could produce one of these immutable #{10} binaries that would look like a BINARY! but that had no series allocation.
 
append take take #{0010FF} #{7F} <- how much shuffling of internal representation would you get here?
Another alternative in lieu of bitwise operations might be to have a 'byte' type with different lengths: 32#7FFFFFFF 8#7F
(the meaning of 8# or 32# or 64# may be confused with similar notation for binary encoding methods though)
 
@rgchris The "small series optimization" means that if any series can fit into a node, it will use the node itself as space instead of using that space to track the allocation of other space. Small binaries like that would fit inside the node, a 32-bit platform has (4x32-bit) space, so enough for 16 bytes. But that is 15 bytes of binary data, because binaries are terminated with #{00} internally to make it possible to AS TEXT! them if they are legal UTF-8.
So long as you stay within 16 bytes it will just be inside the node. The data has to be shuffled because there's no "bias" (the data lives in the tracking info where that would be for moving the data off the allocation pointer), so it will slide #{10FF 00} left and then #{FF 00} left.
32 bytes for 64-bit platforms.
 
 
5 hours later…
7:17 PM
posted on July 18, 2020 by @hostilefork Brian Dickens

@hostilefork wrote: I just had a bug that was rather frustrating to find. I changed: foo: func [ {Description} param [...] /refine ][ ... ] into: foo-core: func [ {Description} param [...] /refine ][ ... ] foo: adapt 'foo-core [ {Description} ][ ... ] But ADAPT doesn't take two parameters. I should have elim

 
Just wanted to express how I feel about this community here and value the work done. SUPER!
2
 
7:36 PM
@iArnold Hopefully more people will appreciate it someday; just got to keep slogging along.
>> if [1 = 1] [print "Ren-C has your back"]
** Script Error: Literal block used as conditional [1 = 1]
    >> if '[1 = 1] [print "And you can work around it"]
    And you can work around it

    >> condition: [1 = 1]
    >> do compose [if '(condition) [print "The tools are there, if that's what you meant."]]
    The tools are there, if that's what you meant.
As my easily-a-half-hour-to-debug-a-mistake just shows, it's not just newbies who benefit from having a few more checks in there. I had the source code and could inject tests in the C to diagnose what was going wrong. Still took time.
 
7:56 PM
>> replace "abc♣def" '♣ "[club]"
== "abc[club]def"
So that also works in Red. I continue to go on the assumption that this is a good thing, and that PARSE should honor it as well.
red>> parse "abc♣def" ["abc" '♣ "def"]
== false
I'm going with my thesis statement that PARSE and FIND should use the same rules. If FIND would find it, PARSE should match it.
If PARSE would error on the type as a bad rule for the input, FIND should error on the type as a bad rule for the find.
 

« first day (3548 days earlier)      last day (232 days later) »