« first day (2577 days earlier)      last day (1203 days later) » 

1:47 AM
posted on November 20, 2017 by hostilefork

While Rebol2, R3-Alpha, and Red attempted to apply some amount of decoding (e.g. how %20 is "space" in http:// URL!s), this changes to leave URLs "as-is". This serves the goal that a URL may be copied from a web browser bar, printed/molded out, and pasted back round-trip. It also means that the URL may be used with custom schemes (odbc://...) that have different ideas of the meaning of c

4
 
1:58 AM
@rgchris ^-- well, that bit was easy. :-/ In any case, it seems to me that's the main "C-level" change that's needed to start experimenting in userspace with whatever other ideas there are.
It raises a question about what to do at a mechanical level if the URL gets something like a literal space put in the middle of it, and how much responsibility the system takes for a situation like that. I dunno.
 
 
2 hours later…
3:57 AM
IIRC, UTF-8 casings of letters may not be all the same number of bytes. So you can have two different equal-for-binding-purposes UTF-8 strings which are of different byte lengths. But you can't have two different equal-for-binding-purposes UTF-8 strings which are of different character lengths. Right?
 
 
1 hour later…
5:11 AM
One application for @word I've thought of would be if you could say foo: func [x] [fail @x] and what that would mean is that it would implicate the callsite of foo (a generic "invalid arg" that pinned the crash on foo "blah" and said "blah" was the problem.
I've wondered in the spirit of "skipping" if this could actually be used with the expectation that you'd have the failure message after it. fail @x ["You didn't pass a STRING! that began with the letter" letter]
I notice there's a sort of problem when you have a refinement where the refinement contributes something very important, and yet it winds up tacked on the end of everything else...which is why I thought <skip> might be relevant.
contrast fail/where [...] 'x to fail @x [...]
 
 
9 hours later…
2:15 PM
posted on November 20, 2017 by hostilefork

This makes rebPanic() an API which if it receives a UTF-8 string will dispatch it to the PANIC native...and if it receives a REBVAL* value pointer it will dispatch it to the PANIC-VALUE native. By default, those natives do the debug-aware procedure of dumping as much information as possible--the same as panic() when called from the C core. However, making them functions offers two advanta

 
2:30 PM
@HostileFork Sadly that is true only if the strings are in the same one of the two canonical forms.
I recommend canonicalisation of words, but this stresses your "strings can be words" idea a bit.
 
 
1 hour later…
3:51 PM
@MarkI I was kind of hoping Red would sort all that stuff out, but I don't know that they have. :-/
>> mp-mutate: enclose 'multiply func [f] [
[   f/value1: 5
[   result: do f
[   return result + 1
[   ]
== make function! [[value1 value2 return:]]

>> mp-mutate 100 5
== 26
^-- @giuliolunati @GrahamChiu meet ENCLOSE... it is like ADAPT and CHAIN rolled into one. It intercepts the call, lets you tweak the frame and then either choose to run it or not...and you have access to the result of the evaluation!
So above, it gets a frame for MULTIPLY with 100 as value1 and 5 as value2. Then it turns value1 to 5 before the call. Then the DO is when it decides to make the call and gets the result. Then it adds 1 to the result. Hence 26!
 
 
1 hour later…
5:18 PM
posted on November 20, 2017 by hostilefork

This adds a new function generator called ENCLOSE. It is similar to a combination of ADAPT and CHAIN, but is strictly more powerful than both (alone or combined). ENCLOSE takes an outer function and an inner function. The outer function should be single-arity, and accept a fulfilled frame for invoking the inner function (which it does with DO, as DO on a FRAME! knows what function that

 
5:56 PM
@Edoc ^-- cool, huh? :-) FRAME! is really crucial.
 
 
3 hours later…
8:40 PM
I know I just keep coming up with the hits lately, but everyone ready to get ze-blown-away, no?
Function Changes on Rebol3 Porting Guide ("Ren-C" branch)
REDO is a function that takes a running FRAME! (or a means of finding a running FRAME!--such as a WORD! of a local variable, or FUNCTION! representing a definitional return) and causes it to restar...
3
 
Labeled "Cool" ;-)
@HostileFork I suppose they have a severe case of writers block lately.
 
9:02 PM
    inner: func [n /captured-frame f] [
        if n = 0 [
           return "failure"
        ]
        n: 0
        redo f ;-- should redo OUTER, not INNER
    ]

    outer: adapt 'inner [
        f: context-of 'n
        captured-frame: true
        if n = 0 [
            return "success!"
        ]
        ;-- fall through to inner
        ;-- it is running in the same frame's memory, but...
        ;-- f FRAME! value should have captured outer's "phase"
    ]
>> outer 1
== "success!"
@iArnold ^-- it's all quite a lot of cool.
 
9:16 PM
posted on November 20, 2017 by hostilefork

REDO is a function that takes a running FRAME! (or a means of finding a running FRAME!--such as a WORD! of a local variable, or FUNCTION! representing a definitional return) and causes it to restart the function with its current state--without creating another stack frame. This allows one to program in a style similar to recursion, but without running the risk of stack overflows. Consider

 
@HostileFork More a kind of brainfreeze for me, can't follow what is happening there.
 
@iArnold REDO will just take a function and restart it from the top. It's like a GOTO that jumps up to the start of the function, leaving its arguments and refinements as is. But the question REDO has to answer is which function, since there's no scope. So you have to pass it something for it to figure out the function from.
Ren-C has a concrete concept known as a FRAME! that is generated on each function call instance. So that's pretty unambiguous, seemingly... you just REDO the FRAME! and jump to the start of that specific call (assuming it's still on the stack)
But it's not as unambiguous as it seems, because a single set of locals and refinements may be used by several "phases" of a composite function. There are mechanics in the system though that even though the same memory is used, different FRAME! values can say which phase it is in.
@MarkI So the long-awaited tail-call recursion is here...if you want to think of any more tests. here are some "better-than-nothing" tests to start with
 
I did not even see the redo function in the example. Reminds me of this experiment youtube.com/watch?v=IGQmdoK_ZfY
 
@HostileFork Nothing short of brilliant, HF. Awesome.
3
 
@MarkI <bows> ... one novelty of it that was new-to-me-idea of today that I do like is the redo :return idiom. I had been wondering how to wedge in /REDO as a refinement on the definitional return that functions already had, but that's ugly because now you're passing an argument to the return it can't use for anything.
Twisting it backward kind of hints to you that something is going on return-oriented, and unusual...and it glosses about the same as a RETURN/REDO which magically takes 0 args.
So I'm still trying to keep things all encapsulated, where the convention is that you're not allowed to see inside a running function unless it lets you. So if you do something like foo: func [x] [x: x + 1 | bar] | f: make frame! :foo | f/x: 10 | bar: does [print f/x] | do f that will be an error when bar tries to access f/x...
But it won't be because DO makes a copy of the data in the frame. It will because it stole the data out of F's frame node and took it over in a place that could not be accessed by the old F reference.
If you care to have your own copy of a frame's data before you DO it, then you need to do copy f. Then you can reuse that F however many times you want. But you shouldn't have access to the end state of F's frame; that's outside of your contract...all you get is a return value.
What all of these things are leading up to--slowly--is userspace evaluator hooks. A function that gets a FRAME! prior to its execution, can pick it apart, decide to call it or not, and do something with the result.
 
10:07 PM
I think there's no way around thinking that what a "method" is--is a FUNCTION! value that has a binding to an OBJECT!--the way a RETURN above has a binding to a FRAME!. That's how you avoid making copies of the functions but give them a unique character. As evidenced by the acrobatics above, the mechanics are working reasonably.
 
10:39 PM
@Brett Look at all the fun stuff! Doesn't it make you want to come work on some Rebol? :-)
 
@HostileFork These latest changes look impressive. They prod one to think about the fundementals of rebol. E.g I think "how fundamental is frame?" and "if blocks had their own symbol table would it be a frame?" then I shelve the ideas, but the point is the thinking about the conceptual bedrock that you're digging down to. What are the smallest parts that can simulate other system etc..
@HostileFork Yes, but I don't have time right now.
Sadly.
Well not too sadly, because it means I'm going on holidays soon.
 
@Brett We'll see where it goes. I've wondered about what sort of situation it would be if the core concept was that all functions were zero arity variadics, with the ability to grab arguments with their parameter conventions, and then FUNCTION! as we know it today offering predictability via parameter specs would be userspace.
 
@HostileFork Had occurred to me that functions today are perhaps just a way to set arguments to a frame by position vs setting by name with a frame.
In that sense the function spec is a simplified parser in the Do dialect.
Guess that lines up with what you're saying.
 
Well hopefully people will be able to experiment, the most freeform programming language just keeps getting more freeform.
 
The one thing that nags in my mind is "can all this good stuff be leveraged by dialect writers?", but I guess you are laying the groundwork for that.
 
10:48 PM
It seems we'll wind up with the ability to eval blocks inline. I was thinking of even calling it inline. block: [+ 2] then 1 inline block giving you 3.
The mechanics for that are coming from the C API (rebDo("1", rebInline(block), END)), but seems cool to put it in the language proper as well.
 
Another interesting capability!
 
UTF-8 string parts in rebDo() will be active. REBVAL* passed in will be inert. rebDo("f:", some_function, END); for instance will not call some_function, but the set-word coming from the string will be live. But you can fiddle with it via modifiers, rebDo("f:", rebEval(some_function), END);
If you have a STRING! you can also get that to load and be active with rebInline(), and presumably with INLINE too. 1 inline "+ 2"
@Brett I think with UTF-8 everywhere as the internal string format, a lot of possibilities are going to start jumping out of the woodwork, e.g. using the scanner in PARSE. parse "{something} 123" [set s string! set i integer!]
 
That would be nice.
I better go, but the direction you're going in looks exciting.
2
 
@Brett Hopefully, things do seem to be picking up. I said that the infrastructure work was going to help speed things up as time went on, where I predicted the methods of Red as a rehash of old Rebol-style "cowboy-coded-C" engineering would mean it would slow down... we'll see. Definitely able to do big infrastructure shifts quickly with all the checks and diagnostics.
 
Excellent. Ok, 'till next time ..
 
11:00 PM
TTYL
 

« first day (2577 days earlier)      last day (1203 days later) »