r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Geomol
2-Sep-2009
[17132]
A problem is though, if I wanna change such a protected value anyway. 
Then I have to first unprotect, change and (maybe) protect again. 
Alternatively, REBOL would need a new flag on values, that mark them 
as "changable constants" or "not-being-copied values" or whatever. 
A rule could be, that such values doesn't get cloned, but they can 
be changed effecting all objects having them.
BrianH
3-Sep-2009
[17133x2]
R3 alpha 81 out, with the new modules. The existing module docs are 
mostly correct now, though still incomplete.
The module docs were good before, but the module system didn't work 
the way specified. Now it does.
Pekr
3-Sep-2009
[17135]
So, finally your changes applied? :-)
BrianH
3-Sep-2009
[17136]
Yeah, and only two words were wrong in the released version :)

My bad, not Carl's. The errors caused by the two wrong words are 
minor.
Pekr
3-Sep-2009
[17137]
BrianH: is new object creation method already in-place? Does it cover 
the changes, you were suggesting in the past? Or simply put - what 
you think should come next?
BrianH
3-Sep-2009
[17138x3]
The new object creation method is not in place yet, but the R2-style 
MAKE object! semantics are working, as are the COPY changes.
Most of the changes I suggested in the past for object! have been 
implemented using entirely different methods, but they're there.
I would prefer that the next version work on the new object spec 
block and the rest of the copy semantics. The version after that 
can focus on splitting off the system context. After that, I would 
love it if the rest of the PROTECT bugs were fixed.
Steeve
3-Sep-2009
[17141]
>> ? in
USAGE:
        IN object word
        Returns the word or block in the object's context.
ARGUMENTS:
        object (any-object! block!)
        word (any-word! block! paren!) 


IN allow a list of objects OR a list of words as parameters but not 
together.

IN context [a: b: 1] [a b] == OK
IN reduce [context [a: 1] context [b: 2]] 'a == OK


But the more powerfull behaviour, to be hable to bind a block with 
a list of objects is forbidden.


IN reduce [context [a: 1] context [b: 2]] [a b] == ** Script error: 
invalid argument: [a b]

Why ????
BrianH
3-Sep-2009
[17142]
There's a ticket about that already. "Why?" is that the behavior 
is undefined (as of yet).
Steeve
3-Sep-2009
[17143]
don't find the ticket...
BrianH
3-Sep-2009
[17144x2]
#895
It's hard to find a ticket about IN - the word is too common in English.
Steeve
3-Sep-2009
[17146]
yep
Pekr
3-Sep-2009
[17147]
Uf, I have put extensive comment to the R3 release strategy into 
It came from the outer space blog :-)
Robert
4-Sep-2009
[17148]
Can some of the R3 gurus answer a couple of questions I have regarding 
extensions (DLLs).


1. Is it possible to use a mutlti-threaded DLL? R2 can't receive 
return- data from a multi-threaded DLL.


2. Is it possible to do a callback into R3 so that I can use async 
calls to the DLL? Or do I still have to use a localhost interface 
for this?
Pekr
4-Sep-2009
[17149x2]
No callbacks yet. Max proposed interesting solution - one mezzanine 
dispatcher for one extension handler. You can see his proposals in 
R3 Chat realated topic. As for threading - dunno. There are simply 
still some features missing, e.g. it is not clear how to work with 
Devices yet, but I only parrot what BrianH said, so better wait for 
gurus to give you some real answers :-)
A82 released - other OSes up-to-date now, excluding Extensions ....
Henrik
4-Sep-2009
[17151]
It seems OSX A82 is more stable. It can at least launch chat.
Geomol
4-Sep-2009
[17152]
I've thought a great deal more about shared content within objects. 
One problem is, they're called objects, because we then think of 
objects, as we understand them in other languages. If we think of 
them as contexts instead, then the goal to achieve is to share something 
between contexts.

Do we want to share words or values?


If we share values, then we could have one word in one context point 
to the same value as another words in another context. We can do 
this today with indirect values (like strings, blocks, contexts, 
etc.), but not immediate values like integers.


I think, it's better to share words between contexts. With this, 
I mean, that some word in one context should give the same value 
as the same word in another context, if I so choose.

>> same? context1/my-word context2/my-word
== true


And if I change the value for my-word in one context, then the value 
for the same word in the other context should change too (if I've 
specified this word to be a shared word). We can't do this with words 
representing immediate values in REBOL. So I see too simple solution 
(simple as in not complex):


1) Either a new type of word, the shared word, is implemented in 
the language, and this can handle both immediate and indirect values.

2) Or the simple R2 rule is enough. In R2, contexts within contexts 
are not cloned, but everything else is. We as programmers then have 
to put our shared words (representing all types of values, both immediate 
and indirect) inside contexts in our contexts (or using the REBOL 
terminology: inside objects within objects).

(Ah, good to get all this off my chest.) ;-)
Pekr
4-Sep-2009
[17153]
... or we work with what we've got, which covers your requests, albeit 
a bit more complexly, otoh without the need to introduce new word-type 
:-) As for your second point, I want to have freedom to clone/share 
anywhere, not just whery system prescribes me to do so (subobject). 
You can post your comment to R3 Chat, to see what Carl thinks. Hopefully 
some other ppl will comment here ... especially Max ... where's MAX, 
when you need him? :-)
Robert
4-Sep-2009
[17154]
Geomol, regarding 1: Sounds good to me. And maybe we can make a big 
step forward to lazy evaluation including immediate values.
Pekr
4-Sep-2009
[17155]
Robert - do you need such lazy evaluation? I mean - even 'alias seems 
being removed from R3. Don't we have enough of reflectivity? Anyway 
- anyone who imo wants to propose something, should definitely do 
so in terms of CureCode or R3 Chat, or Carl WILL NOT know about the 
request at all, and your only chance here will be BrianH :-)
BrianH
4-Sep-2009
[17156x5]
Robert:

1. The extension interface is currently single-threaded, but that 
shouldn't affect what the DLL does inside itself.

2. Devices are the standard R3 method of handling asynchronous behavior. 
Though the extension interface currently doesn't support the creation 
of devices, that is intended to be supported next. Maxim's callbacks 
may be supported too, but what you are talking about is a job for 
devices.
Geomol, the main problem with sharing is doing it in a manageable 
way. The advantage of using explicitly shared contexts is that you 
can know where your values are and distingish them from non-shared 
values.


Your idea about a different word type for shared values won't work 
because words don't actually contain anything. All values are stored 
in contexts, blocks or type-specific containers. All values "assigned 
to words" are contained in contexts, no exceptions. Even function 
words are associated with contexts. The question is which one.

R3 has two context types already:

- object!: Similar to system/words in R2, though for some internal 
instances (like error!) expansion is blocked. Direct reference.

- function!: Not expandable, stack-relative reference. Task and recursion 
safe.


Closures have object-style contexts, with a new instance created 
with every call (with bind/copy overhead on the code block, sort-of).
There will be ways to make object word references more task-safe, 
but that isn't implemented yet. Focus on that: it's the real problem.
Robert, you can do lazy evaluation using functions that replace themselves 
with their results. Anything more requires a full language semantics 
overhaul, and might not be possible in an interpreted language. What 
do you hope to accomplish?
Most algorithms that would benefit from laziness are done in REBOL 
using code blocks or get-word parameters.
Steeve
4-Sep-2009
[17161]
Btw, who is Robert ? Geomol ?
BrianH
4-Sep-2009
[17162]
Right-click on their names. They've been here for a while :)
Steeve
4-Sep-2009
[17163x2]
Sorry, i was seeking the post related to laziness from Robert and 
didn't found it....
I was wondering if Geomol was Robert
BrianH
4-Sep-2009
[17165]
Geomol is John. Robert's laziness post starts with "Geomol, regarding 
1".
Steeve
4-Sep-2009
[17166x2]
yep, found it now
Sort of...


lazy: funco [code][does reduce [first back stack/block 2 to-paren 
code]]
c: context [
	a: lazy [b + c]
	b: lazy [c + 5]
	c: 2
]


>>probe c
==make object! [
    a: make function! [[][
        a: (b + c)
    ]]
    b: make function! [[][
        b: (c + 5)
    ]]
    c: 2
]

>> c/b
== 7
>>probe c
>>make object! [
    a: make function! [[][
        a: (b + c)
    ]]
    b: 7
    c: 2
]

>>c/a
==9
>> probe c
==make object! [
    a: 9
    b: 7
    c: 2
]
BrianH
4-Sep-2009
[17168x2]
I was thinking named functions assigning results to their names, 
but with debug access that way will work too :)
I used a similar method to write the ONCE function.
Geomol
5-Sep-2009
[17170x6]
Steeve, who are you?
Robert: http://www.colellachiara.com/devcon05/robert.html
Me: http://www.colellachiara.com/devcon05/john.html
Brian wrote "Your idea about a different word type for shared values 
won't work because words don't actually contain anything."


Don't say, it won't work. It can be made to work, if the will is 
there. I can think of many different possible implementations of 
REBOL with the current behaviour, we see. As I don't know, how exactly 
REBOL is implemented (I guess, only Carl does), I won't go in detail 
how to do, what I propose. Anyway, I personal feel, it might NOT 
be worth the efford to implement, what a programmer would observe 
as shared words. The C code will be more complex, and it will probably 
hit performance to some degree. Shared contexts within contexts as 
in R2 is probably just fine. Only problem (as I see it) in R2, is 
that it's difficult to not share contexts within contexts. But the 
R3 possibility to copy contexts can solve that. I think, the current 
R3 implementation of contexts (objects) and the copy semantics is 
far too complex.
Someone named Nick suggested having make/deep:
http://www.rebol.net/cgi-bin/r3blog.r?view=0239#comments

This could remove the need for copying contexts:

new-object: make/deep old-object [ ... ]

instead of what we have to do now:

new-object: make copy/types old-object any-type! [ ... ]
But the /deep refinement for make would only be used with objects, 
and it's maybe not ok to add a refinement to a function, if it's 
only to be used with one certain type of argument?
If not, then it could be solved with a new function: make-deep, make-new 
to something.
From time to time I ask myself, why I write so much about all this. 
It's because I care for the language, and I see many stange implementation 
decisions, and that's not good.
Steeve
5-Sep-2009
[17176]
Geomol, my question was poorly worded.

I was wondering why Brian called you Robert (i didn't see the previous 
post from Robert)
Geomol
5-Sep-2009
[17177x2]
Ah, ok! :-D
Oh my, it's not even enough to just copy/types, I have to do copy/deep/types 
to get a completely new object:

new-object: make copy/deep/types old-object any-type! [ ... ]

Does that look simple? No!
Steeve
5-Sep-2009
[17179]
you just need to make a wrapper.

>>make-full: funco [obj spec][make copy/deep/types obj any-type! 
spec]

Is this such a pain in the ass ? ;-)
Geomol
5-Sep-2009
[17180]
Yeah! I then need to remember to include this function in all my 
code. It would be better, if the language just did it right in the 
first place. ... time to make my own language. ;-)
Steeve
5-Sep-2009
[17181]
Ask Brian for a mezzanine :-)