« first day (3544 days earlier)      last day (236 days later) » 

12:56 AM
@rgchris Patched to add /RESULT to TRAP and CATCH. Includes fix for CATCH/QUIT I noticed recently. github.com/metaeducation/ren-c/commit/…
 
 
13 hours later…
2:13 PM
I've run into an insidious problem with the dev build (R3C before the patches) and also some newer versions of Ren-C. I haven't figured out how to isolate it yet (despite a few hours trying) and can't really reproduce (or not) on the latest Ren-C without rewriting the module (is RSP).
After running just a couple of RSP tests, the intepreter bombs (shell code 255) without any information. Using TRACE offers no actionable insight.
Incidentally, the Downloads link in chat appears to be broken—any reason it's not still just a page of download links?
 
2:25 PM
@rgchris You'll have to talk to the owners of the link. I never made such a thing.
@rgchris A non-isolated problem is fine if reproducible, a debug build would likely point the finger at the right place and break into the debugger.
 
I thought the dev build was a debug build. Will double check...
 
@rgchris A debug build can still crash. If you have a bad pointer and it dereferences it, that will not give you a meaningful assert. But if you run under a debugger you see the line where the bad pointer use happens.
 
How do I do that?
 
@rgchris The basic gist of debugging in C is: you have symbol information in your binary or not, controlled by putting "-g" on the compile line. This just means that all the generated assembly code for functions and variables is augmented with a table saying what source text names and datatypes went with those assembly bits. That way you can use something like XCode or Visual Studio to step through source vs. reading gibberish machine code.
Let's call that "symbols".
Then there is the question of whether added paranoid checks under assert() are compiled in or not. In some builds the assert()s vaporize, in others they execute code. These help you know when something is going wrong before you have some downstream bad effect or crash. Let's call this switch "asserts".
Optimization settings also come into play somewhat. The C compiler when it optimizes does all kinds of things, including reordering instructions when it is safe to do so, to get better data locality or whatever. But unfortunately, if you try to debug an optimized executable it's wacky. Some variables won't exist, because they'll vanish into registers. You'll try stepping over statements that should be sequential and it will erratically pop all over the codebase.
The safest bet is to go with -O0, for optimization zero. GCC has a setting for -Og, which is "optimize as much as you can without making debugging crazy" (clang lacks this setting).
Then in our modern world there is also address sanitizer. If you choose debug: sanitize (or debug=sanitize) on your make.r command line, you will compile in a memory checker that will give you a stack dump on bad memory accesses...even without being in a debugger.
Sanitization makes the executable much bigger and slower, because it injects all kinds of barriers around code and buffer zones around memory, to notice things going out of bounds and corrupting these otherwise-unused borders. However, it is faster than Valgrind, which has to simulate the program on a virtual processor to get the same effect.
If you compile a sanitized build, it will run more slowly but give you a good dump of information to see what routine is crashing and the stack of who (if any) freed the memory that's being dereferenced.
e.g. you should get more comprehensive info than just exit(255)
So Ren-C's debug options are: none, symbols, asserts, normal, sanitize
R3C may have been at a different naming scheme for these categories, I don't recall.
IIRC the normal implies both symbols and asserts...while sanitize implies symbols and asserts and sanitize.
 
2:58 PM
I forget—is the debug build the default build?
(when doing r3 make.r)
 
3:15 PM
Hm, as far as I can tell, it was EVAL that was the source of the problem. I see EVAL was changed to REEVAL in #69b809f9 and must have been changed later in the main branch.
 
 
4 hours later…
6:48 PM
@rgchris Yes, EVAL was renamed due to the abbreviations should be equivalent to full names philosophy. So EVAL would mean the same thing as EVALUATE. I don't think I defined EVAL (to help catch old name usages more easily) and I didn't make a REEVALUTE spelled out fully yet.
@rgchris I believe the default is still a release build.
 
 
1 hour later…
8:01 PM
@rgchris I'm all for you getting up to speed on having a debugging environment and learning to hack on the C source. But a guided introduction to that may be more useful. If you need help setting up XCode to do it and a walkthrough we could go through that on TeamViewer where I remote control your machine...perhaps you could watch me look into it and I could narrate what I'm doing.
 
 
1 hour later…
9:04 PM
Ren-C is getting easier to hack on, with advancements in being able to make libRebol "easy" calls from inside of natives. It won't be as efficient as getting nitty-gritty with the guts of cells and nodes, but it can be a good wedge for getting things working first...and then optimizing later. You can see that when I added the /RESULT feature to CATCH
The details of GC safety with PUSH_GC_GUARD or "specifiers/relative-values" etc. all can be bypassed, and you can write what looks a lot like plain Rebol inline. So it's a great prototyping tool.
 
@HostileForksaysdonttrustSE I'd be for that, but I'm not quite at that point yet.
@HostileForksaysdonttrustSE REEVAL seems to work the way I had EVAL working at some other point—good enough for my short-term needs.
 
@rgchris So...I switched back to GET/ANY and SET/ANY for setting and getting VOID!s. NULL is not considered an error. I'll patch that in too. Discussion: forum.rebol.info/t/does-set-any-get-any-thing-matter-anymore/…
@rgchris Though it's a property of SET the function only, since VOID! assignments were made legal via SET-WORD! and SET-PATH! forum.rebol.info/t/…
Again, these are all points up for discussion. We could say that set word non void! (...whatever...) is the better answer if that's what you want, and save ourselves the trouble of a refinement.
And of course people being able to wrap and enclose and add refinements after the fact would let someone who wanted a stricter policy make their own SET with a /ANY refinement.
This concept of not trying to make the core too prescriptive and just give you a "complete" set of parts is where I'm leaning, I cover it in "Make your own safety?"
 
9:23 PM
What is the best resource for understanding what a FRAME! is?
 
All this worry about VOID! seems to pale in comparison to the value of set number-variable ensure integer! (...expression...), and you get tripped up a lot, so this is the direction I kind of see things going in. We're probably just making headaches for power users while not teaching people to help themselves.
 
@HostileForksaysdonttrustSE Yup, ENSURE will be critical.
 
@rgchris Given ENSURE and its complement NON, would you say that maybe it's all right for SET to drop the /ANY...and that SET-WORD! permitting VOID! is good? I think GET may be a different issue, where a refinement may be all right.
 
I think so.
 
I haven't regretted the loss of VOID! assignment errors. We don't want to stop void WORD! fetch errors, though, or typos would not be caught.
 
9:30 PM
In that I haven't come across any minefields since considering it.
 
I've always been uncomfortable that when someone writes :var you get two distinct effects... the disarming of functions, and the tolerance of voids/typos.
get 'var would thus be more "safe" by default, by giving you the function as a value but not conflating that with accepting typos or other voids.
But I've racked my brain for if there's some other way, or if :var should only defuse functions and you have to use get/any 'var if you want to read void variables for real.
Again remembering that a void variable can very easily be a typo. It maybe shouldn't be easy to get them got.
 
I feel :var should be the route to disarming functions/errors as the imperative usage—makes passing them on more intuitive.
 
With NULL and VOID! being two separate ideas, and NULL being "friendly"-ish, it has changed the scorecard a bit. I don't know. It would be nice if we had another single-token thing, like ::var to be a "REALLY-GET-WORD!, even if void!"
@rgchris This is my thought, but when trying to write truly general code it sucks to not have a single-token way to say "really, whatever is in var, I want it" and have to resort to GET/ANY
Anyway, I think I'm happy enough to say that the SET-ting side can drop the "/ANY" and put it on you to filter more specifically whatever you do-or-don't want before the SET gets it. That's a strictly more powerful idea, and if you wind up with a void variable let it cause a problem downstream. Setting a void variable is actually probably the least harmful thing, because getting a string when you meant a block will be even harder to debug as it won't be "ornery" to cause swift errors on use.
But I think I like the /ANY on GET, and I will rename it from /OPT in R3C. The "misspelled things are VOID!" change should also be integrated.
If we step back from the idea that :var will work on VOID!, the near term solution can be (get/any 'var). And maybe there will be some other finesse that comes along the line. This will make it more robust for use in getting functions, not glossing over missing things... that is a problem I run into frequently.
@rgchris I don't know there's any particular place to look. It's basically an OBJECT! which has keys/values for each parameter to a function, and it remembers the function it is for... so you can just say do f on a FRAME! value. It knows the function to run and the parameterization of it.
To make a frame for a function, say f: make frame! :my-function. To run it, say do f. If you partially (or completely) fill in some fields of a frame and want to make a function that has those arguments fixed (e.g. a specialization), you can turn that around and specialization: make action! f. (This is a post-R3C-feature).
 
9:56 PM
I'm curious whether it is applicable to a loop body?
 
@rgchris Loop bodies currently are bound to an OBJECT! that the loop creates. So no. We might imagine allowing FRAME!s to be used as loop bodies, in effect that for-each x [1 2 3] f would be equivalent to for-each x [1 2 3] (make action! f), e.g. running the function equivalent of the frame and passing it the argument for x.
But I think if that's what you want then for-each x [1 2 3] (make action! f) would probably be a fine way of saying it. I've also discussed the idea of for-each 'x [1 2 3] [...body...] and for-each [1 2 3] :action using "skippable" detection of the named parameter to distinguish when you needed to name a parameter or not.
 
I was wondering because of the similarities with function blocks, needs to be lightweight for reuse x amount of times.
for-each foo [_][probe binding of 'foo] is still an object.
 
@rgchris The workings of functions are a bit faster because they "relativize" their bodies (e.g. bind the locals) just once, and can be reused many times. Ren-C has the advantage of "specific binding" which gives properties like R3-Alpha CLOSURE without having to copy and rebind the body each time.
A loop with a block of code has the problem that it has no anchor for which to realize that its relativized body might need to be reused again, or to know that something about the binding environment has changed. The umbrella for trying to rethink this and related problems is what I've put under the name "virtual binding"
But since a FUNC is given a name and put in a variable and put off to the side for clear re-use of that same function, you save. You can get that savings by using a function as the body...but not if you re-generate the function each time. Then you're paying even more.
loop 100000 [
    for-each foo [_] func [x] [print ["This costs even more than a block body." x]]
]

printer: func [x] [print ["This is how you save" x]]
loop 100000 [
    for-each foo [_] :printer  ; you only pay for the binding once
]
loop 100000 compose [
    for-each foo [_] (func [x] [print ["Another approach to bind once" x]])
]
 
10:21 PM
What, though, if for-each foo [...] [body] was shorthand for creating a frame equivalent to for-each foo [...] (func [foo][body]) ?
Hm, I guess it's not.
 
10:53 PM
@rgchris There's a lot of design space there, but my point is that you don't get any efficiency gain unless the same function gets reused.
That would have an advantage in the sense that today, FOR-EACH binding is destructive.
func [x] [
    x: 10
    block: [print [x]]  ; set up with binding to local x...
    do block  ; prints 10
    for-each x [1 2 3] block  ; destructively overwrites, prints 1 2 3
    do block  ; prints 3
]
This is where I bring up the "virtual binding" concept which would achieve a binding with similar output effects that was based on using a method very similar to specific binding, where a kind of "frame" (as you would say) is projected through on a body that was not relativized a-priori.
Specific binding is in a sense "virtual" because it gets different effects on the same function body; there's a clever weaving of a "wave" of specification through the call stack that recombines with previously relativized values to give each instantiation of a function unique identity for the words without making a copy.
But that requires the moment of FUNC creation to walk through the body and notice all the args and locals, and make a single "relativized" copy that has marked out all the relationships that need to be considered in this wave of specific binding.
Doing this with a loop body is a different beast; and I have some ideas for it which may require locking the loop body, e.g. BLOCK above would be read only after usage as a loop body... so you might have to say for-each x [1 2 3] copy/deep block if you intended to append to block or modify it later.
But even if you didn't need to make a copy, you'd still be able to get a performant solution where the second DO BLOCK would print 10. Most practical virtual binding concepts I've imagined are based on this.
 

« first day (3544 days earlier)      last day (236 days later) »