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

World: r3wp

[!REBOL3-OLD1]

Ladislav
23-Jun-2009
[15703]
http://www.rebol.org/art-display-article.r?article=w24v- porting 
INCLUDE to R3
Maxim
23-Jun-2009
[15704]
brian I would like your comments on the deep object copy issue ( 
http://www.rebol.net/r3blogs/0212.html)
BrianH
23-Jun-2009
[15705]
I have been trying to think think it through - there are advantages 
and disadvantages to either way. It is harder to undo a copy than 
not...
Maxim
23-Jun-2009
[15706]
exactly, which is why I think we should not be bound by one or the 
other .... 

did you see my posts... I provide some alternatives.
BrianH
23-Jun-2009
[15707]
I'm still thinking. I'll comment after I narrow down this parse bug.
Maxim
23-Jun-2009
[15708x2]
Plus all that binding takes MASSIVE amounts of time for nothing.
(and ram too)
BrianH
23-Jun-2009
[15710]
Either way you need constructor code. The real question is balance.
Maxim
23-Jun-2009
[15711x2]
IMO we need choice.  this is such a fundamental part of data management 
that we cannot let the compiler decide.


would you code in C if all structure copies behaved this way?  if 
this where the case an OS would probably need 1TB of RAM to run.
allowing COPY on objects makes much more sense to me.
BrianH
23-Jun-2009
[15713]
I added a fairly comprehensive comment, with tests. I had to generate 
3 CureCode tickets as a result :(
Maxim
23-Jun-2009
[15714x2]
what is the replacement for first context []  in R3  I can't remember 
the function's name
the why? in R3 is a fabulous idea!
BrianH
23-Jun-2009
[15716]
WORDS-OF, but the 'self word is not included.
Maxim
23-Jun-2009
[15717]
no self ...   COOL  :-)
BrianH
23-Jun-2009
[15718]
And the returned words are bound to the object.
Maxim
23-Jun-2009
[15719x2]
oh that is cool.
I see unbind is now part of R3  :-D
BrianH
23-Jun-2009
[15721]
WORDS-OF works on any-object!, any-function! and map! too, though 
it's only bound to any-object!.
Maxim
23-Jun-2009
[15722]
I could see the binding to map being usefull, it might be impossible 
due to the inner implementation of map
BrianH
23-Jun-2009
[15723]
I'm trying to backport UNBIND to R2, but it's really tricky.
Maxim
23-Jun-2009
[15724]
I've tried several times... I usually end up doing:     load mold 
myblock
BrianH
23-Jun-2009
[15725x2]
You can't bind to a map! because the keys are handled differently, 
with the keys going away when assigned none.
You can't bind to something that might go away :)
Maxim
23-Jun-2009
[15727]
yep  :-)   I guess asking for a word in a map which isn't there returns 
none  ?
BrianH
23-Jun-2009
[15728x2]
Yup :)
Most of map!'s behavior was my idea.
Maxim
23-Jun-2009
[15730x2]
it makes me think of the array type in AREXX  ;-)
are only words supported in map! or are other types usable for the 
key?
BrianH
23-Jun-2009
[15732]
Other types too, but not all other types.
Maxim
23-Jun-2009
[15733]
so scalars, pairs, tuples, strings, words at least?
BrianH
23-Jun-2009
[15734]
Yup.
Maxim
23-Jun-2009
[15735x3]
a trick question... are set and get words enabled? and are they differentiated 
from lit-words?
to me an unbound word is a lit-word in the context of the map...
I'm not sure what I wrote above makes sense.. hahaha
BrianH
23-Jun-2009
[15738x2]
Binaries too, but not block, object or vector types. Word types are 
converted to word!.
All types can be used as values though, except #[none] which will 
make the key disappear.
Maxim
23-Jun-2009
[15740x3]
yep this means we can use the map exactly like in AREXX, very usefull 
for sparse arrays  :-)
if you used the object's pointer in the map internally, we could 
use objects too, it would actually be very usefull and not that much 
heavy to implement.
like find with blocks is very fast.  it only maps the exact same 
object, not a similar object AFAIK.
BrianH
23-Jun-2009
[15743x2]
You can use objects as the values, but the keys need to be hashable 
:)
Map keys get hashed when the map gets large enough. No, I don't know 
how large that is :)
Maxim
23-Jun-2009
[15745]
but the object pointers can be hashed? no?
BrianH
23-Jun-2009
[15746]
Bring it up with Carl :)
Maxim
24-Jun-2009
[15747]
he'll ask me for an example of usage... now I have to scan my brain 
for the last 10 years of REBOL usage... and remember when I'd used 
this... hehe
BrianH
24-Jun-2009
[15748]
The advantage of map keys is that they don't have to be the SAME? 
as the key, they can just be EQUAL? and the hashing speeds things 
up. With objects you either have a reference to it or you don't. 
If you have a reference, you can extend it with new fields, which 
can refer to the values you want to associate with the object. If 
you don't have a reference you need to specify a key within the object 
that you are searching for, and hashing won't help there, but we're 
going to add a mezzanine to do that kind of searching.
Maxim
24-Jun-2009
[15749x2]
the EQUAL? note is very important to mention in the docs... and its 
important for the difference between them to be very explicitely 
defined for all types, somewhere.
the difference between EQUAL? and SAME?
BrianH
24-Jun-2009
[15751]
I believe there is a blog conversation about that now :)
Maxim
24-Jun-2009
[15752]
yep... I just meant... it has to be very precisely/explicitely documented 
 :-)


btw, I added other qualitative word examples for equality-likeness-sameness 
on the post...  might give you ideas for a better scalling of the 
four levels