« first day (807 days earlier)      last day (2973 days later) » 

2:40 AM
@earl Hm?
 
3:14 AM
I often tell people I don't actually know that much Rebol, I just "grok the idea" and support it on principle. I'm afraid I'm crossing over into "knowing a lot about Rebol" territory.
 
3:33 AM
0
Q: What does positional PICK on an object do in Rebol 2, and what's the equivalent Rebol 3?

HostileForkIn Rebol 2: >> foo: [a: 10 b: 20] ;-- silent result >> foo ;-- silent result >> foo/a == 10 >> foo/b == 20 >> first foo == [self a b] >> second foo == [make object! [ a: 10 b: 20 ] 10 20] >> third foo == [a: 1...

Hello @jkjkjk - you should be able to talk now, I upvoted your answer. :-)
@earl I suck at regular expressions and grep, there were actually many instances of foo/-1 in Red.
 
@HostileFork (Indendation that doesn't match the actual block structure, most likely due to missing {}.)
@HostileFork Esp nasty when they are in compound paths, such as a/-1/2/-1/5.
@HostileFork Your question is missing something. What is foo originally, really? Certainly not just a plain block!. I guess you are missing a make object! or context?
 
Red is another one of these... flying by the seat of the pants kinda Rebol codebases that kind of drives me a bit nuts. One has to be a mind reader. A lot of passing parameters as positions in a series, and then peeking backwards in the series, without going through an abstraction layer explaining what you're looking at. Not a lot of sanity checks on groupings via blocks, just knowing "well they're in groups of N..."
@earl Bah, yes, of course. It had scrolled off the screen so I "just retyped it".
@earl Oh you meant this bit...I was looking at the if. :)
 
4:20 AM
Wish the other Rebol folks would get with the program and do nice clean-uppable Q&A here like you guys. I know there's questions and answers flittering back and forth on AltME or wherever. But if there was discipline to put it here, that would be more forward looking for if (when?) Rebol starts to get a following.
 
 
1 hour later…
5:22 AM
I'm just 28 points away from 10k reputation. Once I have that, absolute power will be mine. (If being able to cast a vote to erase questions entirely from this particular website is one's idea of absolute power.)
 
5:36 AM
@earl Ahhh, dammit. I just traced down an infinite loop to the result of not having applied your parse thru patch :-/ Pleeez merge up, Carl!
 
 
9 hours later…
dt2
2:47 PM
Would it be allowed to "fake" questions/answers for q&a? If i had a question, like "how do i json in rebol", and answered it for myself. Then i think, thats a good question/answer for others. Can i post that on SO somehow, or is that considered spam?
 
3:25 PM
@dt2 Using StackOverflow as a way of tracking answers to questions you've answered for yourself is allowed, as evidenced by the fact that you can post a question and an answer at the same time. You cannot accept your own answer for two days, however. And obviously you won't get points for it.
@dt2 Note that Jeff Atwood, one of the founders of StackOverflow, approves of things like the R Flash mob that populated StackOverflow with R questions in order to give the language more exposure.
@dt2 Do note that I already have a JSON question, however. If you have something to add, it might be best to post as an answer to that.
 
 
2 hours later…
5:39 PM
@earl "some subrule - to prevent unwanted infinite loops in R3 this rule stops also when the subrule matches the input but does not advance it"
What does that mean, in layman's terms? I'm dealing with a PARSE difference between R2 and R3 and it involves SOME and INTO, and the deal is the R2 version goes INTO a block that itself does not contain blocks, yet a block rule is matched because the parse position seems to think it's not in the block
Specifically it affects this line labeled "black magic" in Red/System. (@rgchris, feel free to chime in...)
What it's doing is it stores the parse rule itself in blk and is using it recursively. The Red-System header is parameterized by a block, which causes a recursive rule invocation. Problem is that after that rule is run, R3 jumps back to thinking parse position is on the block instead of inside the block. :-/
I'm having some trouble creating a smaller repro for this, but I'll give it a shot. Any hints in the meantime if you think you might know what's going on would help.
(To clarify, in R3 the block! on the cited line winds up matching, while in R2 it does not match.)
 
dt2
5:58 PM
In r2 you can backtrace.
p: [rule] :p
p: saves cursor, :p resets cursor to p. then rule is testet again. since rules can have sideeffects, this may make sense.
do i guess right?
regarding "some subrule ..."
 
7:03 PM
@dt2 Hum, I don't see a difference in R2 and R3 on this. I'm a bit surprised as I would have expected an infinite loop... hmm?
 
@HostileFork Well, that's a rule which does not advances. So combine that with SOME, and you have difference mentioned above:
parse "a" [some [p: "a" :p]] loops in R2, returns false in R3.
@dt2 Yes :)
 
@earl In the interest of laziness, can you see a path toward a R2 and R3 compatible way of doing this?
(e.g. "please fix this for me" :-P)
 
Not sure yet, but I agree that that's pretty certainly what trips you up in the Red/S parse rule you linked to.
The rule does expansion in place and then re-runs on the expansion result. So during the first expansion, the position is not advanced.
In R3, you could use WHILE to get basically the same semantics as R2's ANY. But then, WHILE is not available in R2.
 
Having a rule stored in a variable which picks an R2 or R3 variant is okay, if it's surgical.
 
So I guess you'll have to resort to rewriting SOME explicitly. As the rule is already named, should be simple.
a: [some b] --> a: [b [a |]]
 
7:20 PM
@earl You can do that? Hm. I didn't know you could just put an "or...nothing"
 
So just remove the SOME in line 223, and add [blk |] after line 333 and it should (TM) work.
Well, [r |] is really just another way of writing opt r.
 
@earl I will try this, gotta back out all my debugging spew mumbo jumbo since this seems to have isolated the problem.
Rebol could certainly use an actual debugger. :-/
Most of Rebol's competitors in the interpreted space don't have any decent debugging solution, either. This is where competing in the dark ages has its advantages...
I think it's one reason why JavaScript is so popular: Firebug, Dragonfly, Chrome Developer Tools, etc.
"It may suck, but you can watch it suck in slow motion."
 
 
1 hour later…
8:25 PM
@earl Your idea has gotten me past the issue in the R3 build, and I can continue dealing with other less inscrutable things...but the R2 build hits a "parse limit" error. The formulation of the rule in that style may be too much for certain lengthy constructions (?)
 
8:41 PM
@earl The double acknowledgment of Saphirion on the builds page seems a bit unnecessary... I think one mention would be sufficient. Just in terms of aesthetics I think it would look better to have fewer links in the footer, but that is a more broad thanks than just on the OS/X build so perhaps the better place; I do not know your relationship.
But there are a lot of people to thank, right? It's a build page, not a thanks page...the only reason I think the logo link to article is a good idea is because of the need to get people (esp. Carl) to sign off on it, so it focuses that discussion. Once it's decided and done, no link or credit needed.
(It would just say "Rebol and the Rebol logo are trademarks of Rebol Technologies", the end.)
Also: as you are the one providing the binaries, linking your own name to some sort of presence might comfort some people that you have enough professional liability to not purposefully provide malware.
(I can be swayed by this, in that I will click around someone's portfolio and such before downloading executables from them, and if get the sense that I could reasonably show up at their house with a baseball bat... then they have an incentive to not erase my hard drive on purpose.)
 
9:42 PM
@HostileFork well, you can always turn trace on, if you're feeling lucky...
Be nice if you could direct trace somewhere other than system/ports/output—have some way to parse the result and display it in a more useful/less overwhelming way...
 
@rgchris I only just got the idea to inject trace on and trace off statements in the code itself, near the points I wanted to look at. A simple idea, but not one that had yet occurred to me given my mental model of debugging.
 
It can be illuminating, but can also be overwhelming.
 
Incidentally, if you can think of yet-another-R2-compatible way of solving the problem I describe in parse...earl's seems (so far) to be semantically correct but it chokes R2 on large input. Maybe there's another way?
(It may choke R3 too, I'm not to the point where I know that yet.)
 
@HostileFork Assuming that RT would permit me continued use of that logo ...
 
Do you have a smaller reproduction?
 
9:53 PM
@rgchris parse [some [p: ... :p]]
 
I'm not quite sure what source would be provided to this rule.
 
@earl If you can use the name, I'd imagine you can use the logo too. He probably cares more about the name.
 
@earl In other words, you're working over the same code over and over until it changes?
 
@rgchris Yes. Recursive expansion, basically.
 
@rgchris Literally it's along the lines of [#L 1 Red-System [#L 2 Title: "foo" #L 3 Author: "bar" #L 4 ...] #L 11 #L 12 #include %something.reds ...]
The loader goes in and pokes these line number markers in while it's still a string, then loads it as a block so the line numbers are annotated.
And what's happening is, somehow or another in R2 it happily descends into the block and starts processing [#L 2 Title: "foo" #L 3 Author: "bar" #L 4 ...]. But in R3 you end up backing up to getting, uh, not on that machine right now but let's just say it's more like [[#L 2 Title: "foo" #L 3 Author: "bar" #L 4 ...]]. In any case, by the time you reach that [into blk | block! | paren!] rule it matches the block! in R3, and indeed, it is a block so that part's right at least.
Like I said...I haven't really had a whole lot of success with off-the-cuff attempts to reproduce it, I'd have to just copy it out and start paring it down line by line to the essence. (Which is what I did with that Unicode binary problem, and it's a good way of doing things, but an even "better" way is if you guys just figure it out for me. :-P)
 
10:12 PM
I was targeting a repro against input [a [b]] using SOME, ANY, and BLOCK! such that block! (print "match block") would print "match block" in R3 but not R2.
That's what I'm seeing, but simplified cases seemed to behave the same in R2 and R3.
 
I'm still not certain of the purpose—it's not enough just to match the above input, it modifies it too?
I can see where there's an 'insert on the series after it's matched the block (insert s header).
 
I'm only just seeing this code for the first time, myself, so I'm going to be at a loss to explain it beyond generalities...
 
Yes, just trying to pick it apart as best I can : )
 
But I have gotten past the Red compilation phase with R3, and to the Red/System phase, and at least for "Hello World" the output from the Red phase seems (mostly) identical between R2 and R3. Slight difference in number of leading zeros on some things.
(Requires patched interpreter, and many modifications to Red sources.)
This is looking like the current biggest bottleneck, the rest seems like mostly a pattern of details I've become familiar with by now.
 
I've put your sample here: reb4.me/x/parse-red.r
 
10:25 PM
I don't want to trouble you too much, I can certainly go through this and load in the real data and strike line by line until it is reduced...just wondering if eyeballing it from those more experienced could save me the time.
As I said, it does for the moment seem that earl's fix may be working, it just may not be fitting for files with thousands of lines
 
No worries, just trying to grok the problem.
 
@HostileFork if my fix works, you can also try replacing SOME with WHILE in r3, and see if that works better. if it does, you can make the rule use SOME in R2 and WHILE in R3. not elegant, but maybe the most straightforward.
 
Been out on the soccer field, don't think the cogs are turning at full speed yet : )
 
@earl You seem to grasp what is going on, perhaps you'd be able to write that repro I suggest? (using ANY, SOME, BLOCK! with input [a [b]] that prints out "matched block!" in r3 but does not in R2)
 
parse [a][some [s: 'a (change s 'b) :s | 'b]] <— so this fails in R3 but is ok in R2.
 
10:42 PM
@rgchris So is it fundamentally necessary to change the input to get the difference in behavior?
 
It seems that's the purpose of the 'blk rule. Boil down all those #includes, etc.
 
Well I'll keep going after it, thanks for the help. It may not be the last of dealing with it... Gotta run for the moment!
 
I think this is a shortened version of the problem:
do http://reb4.me/x/parse-red.r
 
@rgchris I get all B's in both R2 and R3...
 
Yes, because I've already updated it with a new rule : )
(sorry)
 
10:58 PM
Ah, okay. Now they're different. :-)
 
I want to say up until 'line-rule, all the rules are looking to modify (preprocess) for the following rules.
And are all of the form s: rule (change s) :s
Then after line-rule this changes.
 
Bear in mind that the goal here is not necessarily to leave this as is, if you have a better idea for doing what's being done here that would be more saliently expressed and work in both R2 and R3 I'm sure that would be welcomed.
My attempt to do minimal changes is mostly because "I have no idea what I'm doing" (as per the image animals).
 
11:24 PM
I think I have a handle on it, but not sure why @earl's rule isn't working.
 
@rgchris It seems to work on shorter files, I just get a parse limit error later. Maybe try with bigger input?
(parse limit error in R2, R3 hasn't got that far yet)
It says it hit 1000 of something
 
@HostileFork Did you try with WHILE instead of SOME?
 
@earl You mean leave the rest as is, just while for R3?
 
Yes
 
@earl Have not tried, but again the problems the R3 build are hitting are not related to this ATM, your modification got it through to the next nuisance
 
11:31 PM
@HostileFork You are not hitting the parse limit error because of rewriting the SOME?
 
R2 hits it, not R3.
And it gets farther along in the compilation
 
Yes, Then leave R2 with the SOME and try R3 with WHILE.
 
Is there a good way to abstract out an isolated keyword like that without turning the whole rule block into a "reduce" deal?
I guess I could make up a word and do a REPLACE
Or even just say, if it's R3 do a replace of 'SOME with 'WHILE
 
You would just give a name to the subrule, and then use WHILE <named> and SOME <named>.
 
Well, there's some boilerplate around it which might make the replace more attractive, in terms of reducing redundancy.
 
11:34 PM
Single line of boilerplate. In either case, it's easy.
blk: [s: (do store-line)]
append blk pick [while some] r3?
append blk 'subrule
parse/case src blk
 
Or, put end skip on each rule that does [s: case (change s new-case) :s end skip]
But boilerplate looks more elegant.
 
@rgchris Actually, I'm trying to avoid r3 conditionality wherever I can. Do you think that would work?
 
Yes.
 
I will give that a try. Basically would it be replacing all skip with end skip?
 
No.
 
11:38 PM
Well, maybe it would work in this particular case, but it doesn't work in the general case:
>> parse "a" [some [p: "a" :p end skip]]
== false
 
Right, but the last cases aren't like that.
 
I think the last case is a red herring.
 
All the cases after 'line-rule advance the input.
 
Yes. But I'm they are most likely not the problem.
It's just that the into blk fails due to the SOME difference, backtracking this particular case to the second option (| block!) which also matches and then messes up things.
 
It's the rules that are positive and don't advance the input that are the problem. So after they've done what they need to do, have them fail and we're on to the next rule.
 
11:44 PM
Speaking of r3?, is there a standard test for r3? I've been trying to treat things on a case by case basis with tests against stuff like value? 'hash! to try and be more "feature-oriented" than "version-oriented", but I don't know that any test exists for this other than maybe doing a TRY block on a WHILE sample and seeing if it throws or not. :-/
 
I do system/version > 2.99.0
Oh, right—features! How about: in system 'catalog
 
@rgchris I may give up on trying to be too clever and do an r3? definition, though I'd be surprised one doesn't exist already in R2/forward...
 
found? in system 'catalog is a commonly used test, yes.
Unfortunately, no general feature flag mechanism has been accepted so far.
 
If you were to try the fail method, it'd be end skip at the end of lines 224 255 272 288 295 302 309 310.
 
@rgchris I will give this a shot. It's only 8 words, thus likely less disruption than a conditional approach. (If it does work, it would be nice if we formalized a good StackOverflow Q&A to link to explaining why it's written that way... I tend not to comment code myself with things like "black magic" :-P)
 
11:55 PM
I think the black magic only refers to the rule being recursive.
I do foresee one problem with the 'end skip' approach: consider rule [A | B | C | D] —if for any reason rule B matches (but is force-failed), rule C will be next, not rule A (per R2 handling).
 

« first day (807 days earlier)      last day (2973 days later) »