« first day (1859 days earlier)      last day (1921 days later) » 

12:49 AM
posted on December 03, 2015 by Bohdan Lechnowsky

Rebol3-controlled walking robot is now available at http://ameridroid.com/products/owen-walking-robot-kit .

 
 
2 hours later…
2:22 AM
@giuliolunati Thanks for the fix! You will be happy to know that I am right now working on fixing up the spec-in-object thing. All objects will have a frame series (that will point to a keylist in its (REBSER->extra.series)...then a spec and body. As mentioned, all objects will likely have a spec...even if it's just a pointer to the common EMPTY_BLOCK
Another major change, with the elimination of FRAME!...
 
2:58 AM
I do think that the way things might go would be like foo: object [<parent> (first data/archetypes) x [integer! float!] <local> y] [x: 1.0 y: "hidden"]. This means that objects can have private members, and do type checking on changes.
The thing that trips me up on that is the fact that frequently functions like to reuse parameters as different types from their interface contract, so it creates a difference between the meaning of specs for functions (type check once on function call) and objects (type check on every assignment)
 
@MarkI you can always use the download script by @earl to get a full local copy of all CC issues github.com/earl/r3-issues
 
@johnk Cool, did not know about that, thanks. How much local disk would it eat do you think?
 
3:14 AM
@RebolBot
m: module [] [x: 10]
bind? first bind [x] m
 
; Brought to you by: try.rebol.nl
== RESULT is an object of value:
   x               integer!  10
 
Forgets that it's a module. This is another reason why the FRAME! death is needed...
(It would also forget it was an error, port...)
 
@HostileFork Er, OK, but those are all any-object types, so "is an object of value" is kind of right ...
 
In my grand categorizations, I believe that saying an object is an any-object is another one of those things that has to go, in terms of cognitive load. Especially now reading the code, it's bad. ANY-CONTEXT! seems a sensible replacement. An OBJECT! thus being an instance of a context, as an ERROR!, etc.
As with the problem of BLOCK when you meant ARRAY, it's a web of misunderstandings at system and user level.
The one wrench in that being that stack frames act as contexts in a weird way, and there are questions about what bind-of returns for a local and if it should be in the ANY-CONTEXT! category. So think on that.
That's really only a problem with the "bad" traditional function, though, because a closure-style execution has a full object as its bindings.
So as before, I may not need to get too concerned about what kinds of answers the people using the optimization hacks get back. Could be a fabricated datatype. optimized-frame! or something.
You won't see it unless you're doing something weird, and when you do that weird thing you will deal with something that has weird answers back for you about itself.
 
3:52 AM
>> do func [/local x][type? bound? 'x]
 
; Brought to you by: try.rebol.nl
== logic!
 
>> do clos [/local x][type? bound? 'x]
 
; Brought to you by: try.rebol.nl
== object!
 
Well, I have to say I don't think logic! should be an any-context :)
 
4:33 AM
@MarkI Fair enough, but that's not what you get as an answer from Ren-C for the binding...
 
@HostileFork All righty then, I'll bite, what do you get?
 
If it's a closure you get an object, if it's a function you get a function!
This is used by definitionally scoped returns. They get the bind-of the very return local they're defining, and use that to be the name of the throw that they watch for
 
5:28 AM
@MarkI not much. The bigger hit is the impact to the CC servers. I can forward you a zipped snapshot from a few months ago which is only a few mb. You can then run the script and it will update any changes entries
 
Nothing has changed, as we've deliberately not been changing it...
@RebolBot
spec: [a: 10 a]
probe bind? third spec
obj: object spec
probe bind? third spec
@RebolBot alive?
 
; Brought to you by: try.rebol.nl
make object! [
    system: make object! [
        product: 'core
        version: 2.101.0.4.2
        build: 19-Feb-2014/17:24:17
        platform: [
            Linux libc6-2-3-x86
        ]
        license: {Copyright 2012 REBOL Technologies
REBOL is a trademark of REBOL Technologies
Licensed under the Apache License, Version 2.0.
See: apache.org/licenses/LICENSE-2.0
}
        catalog: make object! [
            datatypes: [end! unset! none! logic! integer! decimal! percent! money! char! pair! tuple! time! date! binary! string! file! ema
@HostileFork I'm a-liiiiive!!!
 
Ah, just a long question. Shorter one, then...
@RebolBot
spec: [a: 10 a]
before: bind? third spec
obj: object spec
after: bind? third spec
print after = before
 
; Brought to you by: try.rebol.nl
false
 
It seems to me that by default, object needs to deep copy the spec before doing the rebinding. A faster version... object/bind perhaps, could be offered. But it's rather destructive to be giving it a spec which you might use or reuse for other purposes and have it do a rebind on it without asking.
 
6:01 AM
@HostileFork Seems to break the principle of least astonishment. Good example.
 
@johnk You see these things just by looking through the code, and this is now my big "module and object" review.
object/bind seems like a decent name for the version that binds the block, because it does bind the block to the object...
But this does get to the point of suggesting that perhaps MAKE OBJECT! indeed does have to be the binding version, with the copying done in the generator. Because MAKE OBJECT! doesn't have a place to not ask for the rebinding, and we're looking to avoid things at the MAKE level that are keywordish
Increasingly I do want to push the MAKEs down to the level of thing that only those writing generators know about, so they should be the most versatile non-keywordy things they can be.
And this means that basically everything MODULE does is going to be generator level... so as I've predicted there won't be a MODULE! type. Just a set of conventions running atop a more versatile object!
 
posted on December 03, 2015 by Alan Macleod

Thats so cool, Bo

posted on December 03, 2015 by Alan Macleod

I love that stuff

 
6:23 AM
I'm still tinkering around with ideas about how these tags fit inline in specs. So if you want to specify a parent, and you say object [<parent> blah blah blah] [...] how do you know when the parent expression has ended and when more spec material has started? I feel this way about the <return> as well, I feel like you should need a tag each time you switch modes.
function [<return> integer! <args> a b c] [...] as opposed to just function [<return> integer! a b c]. What this does is it lets you be more free with evaluation, so function [<return> get-x-type blah blah <args> a b c] [...] and you can actually run the code but stop it before it gets to <args>.
Definitely need the unified symbol table. :-/ These tags need to be more or less as cheap as words, and then get that benefit systemically.
So each tag gets its own series node, but only gets a unique copy of the data after modification.
Since most of these tags will likely not be modified, they'll all pool together with the same data.
Good general system feature to have... and <return> will pool with return, and #return, and %return etc...
Hm, I guess you should be able to default any optional argument. So not just refinement arguments, but foo: function [x [<opt> integer!] (10)] [...] for instance, so it will act when you say foo if false [...] as if you'd said foo 10.
 
 
3 hours later…
9:44 AM
@giuliolunati Although objects need specs at the source level, I don't know they need to hang onto the spec block the way functions do. It seems that when modules think of a "spec" they hold onto the processed keys and values. I am wanting to call this a "meta", because to me the spec is a block.
 
 
3 hours later…
12:43 PM
@HostileFork Yes, very happy to see you work on spec! :-) My POV: 1) spec is a block 2) can be accessed through spec-of 3) is inherited by childs 4) is shared with childs(?) 5) I want use it to customize actions and some natives.
Here an example from my experimental code:
o: make object! reduce [reduce [:form func [x] [ajoin [x/num "/" x/den]]] [num: 3 den: 4]]
print o ==> 3/4
@HostileFork Now I'm working around mold-stack... maybe not so difficult...
 
 
3 hours later…
3:50 PM
posted on December 03, 2015 by Oldes

FIX: #1472 - Unique case refinement "reversed" for Strings by Oldes

 
4:01 PM
@HostileFork Um, if you need word speed, why not use a word type? Why did you go to tags in the first place?
I see no issue with using issues ... :)
 
4:54 PM
posted on December 03, 2015 by Steven White

The powershell script below seems to run a powershell function that accesses a 'web service' (whatever that is), and then seems to format the data returned from the web service into a 'dot-net object' (whatever that is) so that the 'CurrentWeather' property of that object can be displayed.   Does anyone know if REBOL can do any part of that operation, either access a web service or d

 
5:18 PM
posted on December 03, 2015 by Oldes

Before: red>> type? load {#.+.#} *** Syntax error: invalid value at # *** Where: do now: red>> type? load {#.+.#} == issue!

 
6:16 PM
@MarkI Ditto, actually I would almost think that might work better, imo.
@RebolBot
print ["@HostileFork @MarkI @earl @pekr" newline "@iceflow19 [is aliiiiive!!!](http://www.youtube.com/watch?v=EoGOFjWYDJo)"]
 
; Brought to you by: try.rebol.nl
@HostileFork @MarkI @earl @pekr
@iceflow19 [is aliiiiive!!!](youtube.com/watch?v=EoGOFjWYDJo)
 
@HostileFork How's things been going over in Rebol-land?
 
6:35 PM
@iceflow19 Ah, you are alive. Well, the biggest thing to me (though not necessarily a big issue to people who don't care about such things) is a good schematic solution to definitional returns.
Function Changes on Rebol3 Porting Guide ("Ren/C" branch)
Definitionally-Scoped returns means that a RETURN word can preserve its intended return target, even when passed as a block of code to be executed in other locations. So allowing returns to be def...
 
That's exciting =) I'm itching to play around with that the next time I get the chance.
 
@iceflow19 I probably walked you through the source for COLLECT before, but it's summarized again in this answer
@MarkI earl and I liked tags. I also think it is time we put pressure on the systemic back-and-forth of whether things are unique-identity-strings or symbolic to the point where it becomes another thing that depends on how you choose to use the system.
 
I've read that epic stack overflow post before, along with the answers.
 
Overall the definitional return thing is good news. Lots of interesting news regarding just basic evaluator enhancements in the directions I was looking for. "opting out" for unsets...
Unset Changes on Rebol3 Porting Guide ("Ren/C" branch)
With Rebol already having a unit type in the form of NONE!, the existence of UNSET! at all seemed questionable. It had some "prickly" behaviors that helped cause some locality in errors down the l...
Some weird mechanical things being pushed to try and speed Ren-C up, with a goal of being notably faster than the rebolsource build. It's slower at some things, and will have to be (due to bugfixes and new features)...but I have a goal to try hard to make the overall experience of the system for average code go to something like 2x speed.
 
@HostileFork If it's anybody that can fine tune it and eek out as many cycles as possible I have no doubt it will be you.
Whatever became of the plan to embed tcc in Rebol?
 
6:52 PM
@iceflow19 You never finished it!
 
Me?
 
Just a generic answer to "why isn't X finished" on open source projects is a comeback to say "because you didn't finish it" :-)
Which isn't exactly what you asked, but the plan is still a plan to do.
Because one doesn't actually want to use a less optimized executable of Rebol built with it, the main reason was--again--to allow quick build out of dynamically loadable code to get a kind of JIT functionality
The main reason that's not priority #1 for me is because priority #1 is to have a coherent language people will care how fast it runs or does not.
 
I saw that @ShixinZeng had wrote a higher level binding for it though.
 
Yes, that is good as a simple test to see "if it existed today, would people find a use for it" and the answer is right now there's not enough users looking for uses.
 
True
 
7:00 PM
@iceflow19 oh, the source conversion has been done, if you missed that. All the natives... including native itself... have their specs in the comments, with it all generated for bootstrap
And the tabs are gone, good riddance.
It's good for documentation purposes so you know what you're looking at, it's good because you don't have to go to another place to make the change... change the spec and the C in the same file.
And it's good because process-wise we have a nice pattern for pushing some of the other things into the C source as well, to keep things together.
 
Slick. Are there plans at all to have something similar (in rebol) to doxygen, and generate docs for the interpreter, or do you think the code is well enough self documented to not need that?
I know from the little perusing of the codebase I've done over the past year, getting a grasp of the overarching architecture is a little daunting, though individual components have decent inline documentation.
 
@iceflow19 My goal generally is to keep pushing on inline documentation, and I hope that the architecture will be simple enough that a YouTube talk or otherwise with slides and some pointers to the source could serve as a reference.
 
@HostileFork Thanks. No surprise it's not a good fit then, you're only using it in order to further your other unrelated goals.
 
@MarkI I'm not going to put up with this. Stop it. I told you earl and I agreed. You are now officially free to STFU about things I change, and make your own version.
I told you that's my compromise, modify with confidence.
I'm tired of hearing about what you agree or disagree with, so stop telling me.
Write code, write a blog, but you demoralizing me each day is not good juju.
 
I am mentioning it for a very good reason. And that reason is not to demoralize you!
 
7:14 PM
We agreed on tag before I decided that I thought by and large it sucks that we are forced into a dichotomy about the choice of a word or a string based on reasons other than how it looks and feels as a dialect.
 
I have no issue with you trying things!
 
If all string types could be either in a bound or unbound state, and the loader decides what's what, with a copy-on-write strategy for the data, that's good.
 
I am not trying to say copy-on-write is bad!
 
People get horse-blinders on because they start thinking 'foo is cheaper than "foo", and then get in ridiculous questions about whether #foo is a string or a word when it's evaluator inactive. That is an unnecessary debate. Things are how they act.
 
For you. For others, things are how they look. Like, for language designers.
But do not worry, your message has been received, you do not put up with criticism. Of anything you do or say.
 
7:19 PM
This has become a specific thing with specific people who take a specific angle of response all the time.
 
Physician ...
 
And you are one of those people.
 
No question, I question your stance on no questions.
 
That is not what's happening.
 
What is happening.
 
7:21 PM
3 hours ago, by MarkI
@HostileFork Um, if you need word speed, why not use a word type? Why did you go to tags in the first place?
 
Seems a reasonable ask.
 
41 mins ago, by HostileFork
@MarkI earl and I liked tags. I also think it is time we put pressure on the systemic back-and-forth of whether things are unique-identity-strings or symbolic to the point where it becomes another thing that depends on how you choose to use the system.
9 mins ago, by MarkI
@HostileFork Thanks. No surprise it's not a good fit then, you're only using it in order to further your other unrelated goals.
 
I don't see my error yet.
 
If you saw the error with the way you discuss serious, hard, volunteer work with me then presumably you wouldn't do it.
 
I really don't want to offend you HF, and I'm sorry if I have.
Please help me: how should I have said it?
Tags are not a good fit for word purposes.
If tags are used there, there will be some need to make them faster.
I may have the cause and effect wrong, but the state of affairs is accurate.
 
7:26 PM
> "Do you really think tags are a better choice?"

foo: function [#return integer! #args a [float! string] b c #with d e #local f g][
...
]

vs.

foo: function [<return> integer! <args> a [float! string] b c <with> d e <local> f g][
...
]

"because I, @MarkI, actually like the way the first one looks"
I would say "I disagree, and earl also disagrees."
Note the args indicator is a new question in the design, if such a thing will exist or not to help separate return or other sections more clearly.
Question of if it is needed, if return should be forced to be after the args and args are always first, if args is the right name for it, etc.
 
Personally I cringe at either because I don't like having them all on one line. When multilined both are just as readable.
#<2cents>
<Slowly retreating to the sidelines again>
 
@MarkI The above is a proper example of going to the question instead of presuming incorrectly that we made the choice based on its implementation convenience. The decision was made before there was any plan to do the string unifications, I just think it's going to be good to do them sooner vs. later now.
 
Well, I never thought you (and earl) chose them for the way they look, but whatever.
It may not be a bad idea to phrase my concerns so that all you have to say is "I disagree."
One of my concerns is actually that you are working too hard, by the way.
In this case I will not be offended if you disagree :)
But I am serious about that concern. You should take a break.
Let the code soak for a month or two, if it's in a modify-with-confidence state.
 
Play with Rebol itself. Fix skip in parse. Make a snowman in ASCII. There're lots of things that need doing ...
 
7:37 PM
@MarkI It is time for a sync up of Rebmu, using the customizable definitionally scoped return so it can be r: rt: return: ...
Dropping another train on code golf is still one of the goals.
I need to go over all the existing solutions and patch them up, and see what new tricks can be taken advantage of
@MarkI If you don't want to code on the core proper, there's something you could do, code golfing with Rebmu
 
I am actually furiously busy coding on the core proper. Expect Christmas presents :)
But before I return to it, let me apologize again. I think I was the one with the shirty tone this time. I beg your forgiveness.
 
Eh, I don't really hold grudges, except when I do
But anyway, I think it will be a good thing when this string-word-conundrum goes away
 
I have to say, as I've said before, there would be nothing in it for me if I was just modifying the language for my purposes.
I want this to be a community project. I want it to work for more than just me.
Interesting. Javascript makes everything strings.
I sense you are trying to make everything small integers (as long as nothing is modified).
It's a neat idea.
 
@MarkI Well, pointers. We don't want to forget the unique identity for each string for starters. You can't not-have-identity and then produce it back. Hence they'll be REBSER*, or pointers to pooled nodes.
It's just that they'll have a state where they share a common data pointer which will serve as the symbol.
 
7:52 PM
I also should mention I've never worked collaboratively like this before. There are some things I do that need to improve.
Although, that being said, it probably comes as no surprise that everyone at work gets a scared look when I am about to ask them something ...
So it's not just online that I can seem ... unfair.
I am always trying to be fair. I'm just bad at it.
There could be a table of stringy-things just like there's a table of word structs.
Then you only need to compare the offsets. Don't know if that's worth it though.
 
If a REBSER node is flagged that it is a canon string, then if it is compared against another canon string it will just use the pointer.
If either string is non-canon, it will have to fall back on ordinary comparison.
In essence this is about replacing the symbol table and getting GC'd words at the same time, which I already wanted.
The question of whether or not the canon strings stay UTF-8 is one to consider, because if they do, then they cannot be series enumerated.
 
@HostileFork Hunh?
I've actually considered abandoning non-UTF-8 strings entirely, on all platforms.
 
I mean in-memory representation.
 
As do I.
 
Indexing into a UTF8 string isn't very performant.
Rebol series positions are maintained by an integer offset and a series pointer, and you'd wind up with a lot of wonkiness if the series elements are variable size.
 
8:03 PM
@HostileFork It is if all you want are the encoded byte values :)
 
Well, er, that can be on your branch. What I'm proposing to do with the strings is nowhere near as disruptive as changing the internal loaded representation of strings to UTF8
 
But seriously, I would have a second vector of codepoint indices, and a third vector of glyph indices, and possibly a fourth of grapheme indices.
 
But, it would be quite possible for canon strings to be decoded if-and-when you enumerate into them.
 
So UTF-8 as long as they're not modified, internal (hopefully 32-bit) Unicode afterwards?
 
Well, modification is different. Modification actually has to give the series node a copy of its own data.
(And internal unicode afterward, however that's done, sliding likely as today... 8/16/32 based on need)
 
8:06 PM
Don't forget we haven't even mentioned codepoints that are supposed to compare equal ...
 
I'm saying it's not just modification, but enumeration. Enumeration wouldn't require getting a copy of its own data, however, it just means you can't delay the canon being expanded to internal anymore.
 
@HostileFork Whoa. We slide today? That must be Linux-only, I haven't seen that in my Windows source ...
 
Slides 8/16, no 32 at present, all platforms.
Lookup uses of Is_Wide()
If the codepoints are all <= 255 then some routines that make copies etc. will make note of that when the new string is produced.
Not super systemically "tight" but it's there.
 
Cool, thanks, I'll look deeper.
I should add for the group that I have no intention of targeting this idea for Rebol at all, it was just something I've been toying with.
Because I have yet to find a performant Unicode library in the wild, for my other projects.
@HostileFork I am extra-dumb today HF, can you help me understand what "enumerating into" a string refers to?
 
8:40 PM
@MarkI Just pos: next "abc".
Point being that as long as you don't do that--be it a set-word! or a string! or anything of the sort--you don't have to decode the UTF8
Today words don't ever have the problem because you mechanically cannot do it.
I'm proposing a hybridized world where the behavior in the evaluator is type-dependent but has nothing to do with this other issue. So a word that has not been bound is a string that acts like an unbound word today as far as the evaluator is concerned.
Once you bind it, then it's as if you've protected it, and you cannot enumerate into it any longer.
There are a few mechanical traps with this and I'm just mapping the space at the moment, in whatever spare brain cycles I have for it
But as mentioned, one of the important features we'd get would be GC'd "symbol IDs"
 
@RebolBot
a: []
rule: [some [copy x to newline newline | copy x to end]]
parse {1^/2} rule
 
; Brought to you by: try.rebol.nl
; rebol.com/r3/docs/errors/script-no-value.html
    *** ERROR
** Script error: parse-trace has no value
** Where:
** Near: try load/all join %/users/try-REBOL/data/ system/script/args...
; Brought to you by: try.rebol.nl
== true
 
@redbot
a: []
rule: [some [copy x to newline newline | copy x to end]]
parse {1^/2} rule
 
; Brought to you by: try.rebol.nl

*** Runtime Error 1: access violation
*** at: 08059368h
 
I'm a little confused why that goes into an infinite loop in Red
 
8:51 PM
@kealist Well, it goes into an access violation there... and if you're using a new version where it's going into an infinite loop, it may be a sign of a sensitive condition based on some lack of initialization or otherwise... so the bug just changes its way of manifesting from build to build.
So, report it, and presumably they'll fix it.
 
I tried, but seemed to get a "oh, you just wrote an infinite loop" response
The access violation is an out of memory error
Guess Rebol2 goes into an infinite loop too
 
@kealist Looks like it's the to end part which will work even if you're at the end.
 
@rgchris Ok, that makes sense. Is that a bug in Rebol3 then?
 
>> parse "" [copy x to end (probe x) | end]
 
; Brought to you by: try.rebol.nl
""
== true
 
9:05 PM
@kealist Possibly not because of the no-progression handling.
 
@HostileFork Hm. I see. I suspect length would also trigger it.
 
>> parse "" [some [copy x to end (probe x)]]
 
; Brought to you by: try.rebol.nl
""
== true
 
>> parse "1^/2^/3" [some [copy x to newline newline (probe x) | copy x to end (probe x)]]
 
; Brought to you by: try.rebol.nl
"1"
"2"
"3"
""
== true
 
9:13 PM
Seems to work, sort of. I don't understand why I'm getting the final "" though.
 
@MarkI length might be able to not to. The loading/hashing process, and the zero termination of the utf8 data, likely means that the series length of the un-decoded items could be accurate to the decoded length.
 
@MarkI some/any still process the rule, but only repeat if the index has increased.
 
Is it because 'some will repeat until there's no progress? I thought 'to 'end would either terminate (nothing remaining) or fail (something remaining).
 
to end will always succeed.
 
Hence my belief that asking to match anything afterwards should fail.
But I guess I didn't account for an explicit ask to match nothing at all.
 
9:19 PM
@MarkI Not another to end.
>> parse "" [to end to end to end to end end end to end end to end]
 
; Brought to you by: try.rebol.nl
== true
; Brought to you by: try.rebol.nl
== true
 
It's like parse is it's own language. Oh. Right. It is.
@rgchris Hahaha. You forgot to "to" some of those "end"s.
 
Just making a beat out of it...
 
Fixed it:
>> parse "1^/2^/3" [some [copy x to newline newline (probe x) | and skip copy x to end (probe x)]]
 
; Brought to you by: try.rebol.nl
"1"
"2"
"3"
== true
 
9:24 PM
Sadly, 'and is not in Rebol2 parse.
 
rebol2> parse "1^/2^/3" [some [copy x to newline newline (probe x)] [end | copy x to end (probe x)]]
 
; Brought to you by: try.rebol.nl
"1"
"2"
"3"
== true
; Brought to you by: try.rebol.nl
"1"
"2"
"3"
== true
 
end!
 
>> parse "1^/2^/3" [some [copy x to newline newline (probe x) | end break | copy x to end (probe x)]]
 
; Brought to you by: try.rebol.nl
"1"
"2"
"3"
== true
 
9:36 PM
Also works in both.
@rgchris I think yours is clearer though.
rebol2> parse "1^/2^/3" [some [copy x to newline newline (probe x) | end break | copy x to end (probe x)]]
 
; Brought to you by: try.rebol.nl
"1"
"2"
"3"
== true
 
Hm. Did not know that. There is no way to tell by the response which mode she's executing in.
 
9 hours ago, by giuliolunati
@HostileFork Yes, very happy to see you work on spec! :-) My POV: 1) spec is a block 2) can be accessed through spec-of 3) is inherited by childs 4) is shared with childs(?) 5) I want use it to customize actions and some natives.
Here an example from my experimental code:
o: make object! reduce [reduce [:form func [x] [ajoin [x/num "/" x/den]]] [num: 3 den: 4]]
print o ==> 3/4
@RebolBot
a-module: make module! [[exports: [var]] [var: 2]]
probe spec-of a-module
import a-module
print var
 
; Brought to you by: try.rebol.nl
make object! [
    title: "Untitled"
    name: none
    type: 'module
    version: none
    date: none
    file: none
    author: none
    needs: none
    options: none
    checksum: none
    exports: [var]
]
2
 
@giuliolunati The "spec" as spoken of by the module system is an object. I think that it is a bit confusing terminology-wise, and I have spoken of this as perhaps being the META-OF and offering it as a feature on functions as well.
Noticing again there would be no MODULE! under the system I am speaking of. Just (meta-of module)/type => 'module
The idea in my mind being that META is scratch space, not read at all by the system, whereas the spec it would read, much as it reads function specs.
I think our plan for MAKE should be: make function! [[...body...]], make function! [[...spec...][...body...]], make function! [[...meta...][...spec...][...body...]]. So it reacts to 1, 2, or 3 items. The meta could be a literal object instead of a block, but if it's a block it gets constructed as an object.
Then follow the same for objects. make object! [[...body...]], make object! [[...spec...][...body...]], make object! [[...meta...][...spec...][...body...]].
The wrench in there is where to put the parent. It would have to go in the spec, and we aren't using keywords. So perhaps a raw object reference in the spec. Or several, for multiple inheritance? :-/
 
10:03 PM
@HostileFork we absolutely need a parent?
@HostileFork - please, I need your help to understand what happens when an error occurs... the whole longjmp/trap/etc... thing, starting from ground 0 :-/ ... YAA...
 
@giuliolunati I believe so. This ties into the user desire to inherit functions which--at the time of their authoring--had word bindings to a different object frame. You have two choices in dealing with this: have ways of going around and copying all the relevant function bodies to make copies of functions each time with new bindings, or make the system able to "forward" a binding. Inheritance and knowledge of the parent is the only way to understand the forwarding and do it "securely"
 
@HostileFork ok...
 
@giuliolunati The two basic mechanisms for 'jumping up the stack' are THROW and FAIL. When you throw, it is a controlled exit from the running function...where in the output cell that a native must put its value, you put a thrown value and return gracefully.
FAIL uses longjmp and is "not graceful". It is necessary because some things, like out of memory errors, would be very laborious to concern every part of the system with. Otherwise each time you Make_Series or otherwise, you would have to test the pointer for NULL and find a "nice" way of returning. The code would be very awkward.
The only places that will "trap" fail() are those that explicitly set up PUSH_TRAP to catch it. There is one at the very top level of the interpreter that is a catch-all to keep the system from crashing if there is no other trap in effect.
All other stack frames will just be blown away between the fail() and the trap. Any local malloc() will not get a chance to free, any open files will not be closed, etc.
There are several things that the TRAP macro cleans up, but they are things the system knows about. Any Make_Series() that did not get handed over to be managed by the garbage collector will be cleaned up for you. The data stack will be cleaned up. If there was a guard from GC on a value or a series, that will be cleaned up without needing to DROP_GUARD if there is a fail()
But if there's something the system doesn't know about... a random malloc or other bit of state that would cause a leak or trouble, whoever it is with that needs to set up their own PUSH_TRAP. For an example, see how the zlib inflate state is managed here
@giuliolunati If you need a basic tutorial on setjmp/longjmp you might find some around the web: web.eecs.utk.edu/~huangj/cs360/360/notes/Setjmp/lecture.html
 
10:20 PM
@HostileFork Thank you ! When a fail() occurs deep in the code, where the execution continues?
At the nearest trap?
 
@giuliolunati The most recent PUSH_TRAP or PUSH_UNHALTABLE_TRAP. (If it's a RE_HALT then it will skip an ordinary PUSH_TRAP). It will jump back up to the same point. The first time it ran the error frame was NULL, but then after this jump it will reach that error test with a non-null frame.
This is why the first thing after a PUSH_TRAP is generally a test of that error.
You can assume if the error is not null that all the manually allocated series made since the PUSH_TRAP have been freed, all the PUSH_GUARD of values and series have been released, and a few other things.
Recently, GC-safe arrays allocated on the "chunk stack" will also be freed, and that is a nice service.
So if you need a fixed-size array of values that are protected from the GC and not going to relocate in memory, and you are willing to allocate it in a stacklike way, it's a very fast way of making that--much faster than Make_Array + Free_Array, and you do not have to worry about GC or relocation.
And if the error is null then you're running the first time through and no fail has happened... if your lucky none will and you just run DROP_TRAP at that same stacklevel.
As the name DROP_TRAP_SAME_STACKLEVEL_AS_PUSH suggests :-) you cannot make a call to PUSH_TRAP in one function and then try and drop that state from another one. It has to be in the same function.
 
@HostileFork Thank you so much, I need understand that because of mold-stack work.
 
@giuliolunati Yes, indeed. The mold stack will have to be one of these things marked in the REBOL_STATE... then if there is an error, it will have to drop it back.
So follow the pattern, and add a bit of code to the Push_Trap and Drop_Trap helpers called by those macros
@giuliolunati It will be nice if the mold stack is able to know if a given stretch has any > 255 codepoints in it, I don't know if there is any trick for it to remember this. But imagine if at each stack point it started by saying there wasn't any, and when you add a byte sized series it still says there isn't any...but if you add a series with REBUNI it says now there are maybe some > 255 characters.
Then when you go to "pop" a string off the stack as a new series, it can look at that and know ahead of time which character width to use before it starts copying out the data.
(The mold stack itself will always be REBUNI)
 
10:50 PM
@HostileFork I don't understand what happens here... why doesn't loop forever?
 
@giuliolunati You don't have to drop the trap in the error case. If there is an error, you can consider that the trap is dropped at that point.
If you can think of a better way to convey that let me know!
Call it error_frame_dropped, maybe? :-/
It would be nice if one could write if (!PUSH_TRAP(..., ...)) {error handling} which is what I did initially, but there is a technical problem with that.
I should look at it again to see if things have changed to where the technical problem is no longer applicable.
 
@HostileFork but... where the execution goes after line 285?
 
@giuliolunati To whatever trap was in effect before line 277. So basically the fail is going to wherever a fail at line 276 would have gone.
 
@HostileFork oooh...! So every fail() in that function does the same? Only 'deeper' fail()s go to 277 ?
 
11:21 PM
@giuliolunati If you are handling a failure (e.g. error_frame is not null) then it is different. It is as if the trap has been dropped at that point. The first time through, when error_frame is null, then the fails in the function (between the PUSH_TRAP and DROP_TRAP) will go to 277. It is just because the failure has already happened that it doesn't catch the fail again.
I will contemplate if there is a way of making this clearer.
It may be even more versatile to let the error handlers decide when to drop the trap themselves. Maybe there is something in your manually allocated series you want to look at instead of having them all go away before you are ready.
But there are some parts of the dropping that must be done up front for things to work at all. You have to drop the chunk stack and data stack before calling a DO_NEXT, for instance.
I will look at it, but for now, consider that if there is a longjmp to where you are running the line of code again with an error that now your fails would no longer be caught by the push... it was dropped.
 

« first day (1859 days earlier)      last day (1921 days later) »