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

World: r3wp

[!REBOL3]

BrianH
24-Mar-2010
[1737]
Ladislav, your suggestion to have some contexts not have the hidden 
'self in them at all is not what you think. You are suggesting that 
we create object! contexts (for that is what all contexts are except 
for function! contexts) that *can't* be specified by MAKE object! 
syntax, ever. And thus these objects will have an attribute that 
doesn't show up when you MOLD it (because MOLD generates MAKE object! 
syntax) that affects one of the core features of the BIND function. 
And that attribute wouldn't be serializable even if you added it 
to the MOLD/all syntax, because MOLD/all serialization of objects 
doesn't work: MOLD/all syntax for objects doesn't restore word bindings, 
only DO syntax does.
Steeve
24-Mar-2010
[1738]
Posted, Brian
BrianH
24-Mar-2010
[1739]
Thanks.
Andreas
24-Mar-2010
[1740]
Brian, I think Ladislav wants objects and contexts to be separate 
things. This would most directly be modelled as two different datatypes, 
I guess: object! and context!. The former having the hidden 'self, 
the latter not.
BrianH
24-Mar-2010
[1741]
Or perhaps he hates the idea of a hidden 'self field, and the corresponding 
BIND trick :)
Andreas
24-Mar-2010
[1742x2]
Steeve, while this may be considered a nice trick, I don't think 
it's worth keeping the nasty self around.
map-each [a b] [1 2 3 4 5 6] [copy bind? 'a] does the same and is 
more explicit about what you want.
BrianH
24-Mar-2010
[1744]
Andreas, you also make a good point. Please put that counter-counter-argument 
in a bug#1529 comment.
Andreas
24-Mar-2010
[1745]
(The remark about increased readability of course only makes sense 
if you are accustomed to read bind? as "get-context" :)
Steeve
24-Mar-2010
[1746x2]
yes but it's not an abstraction anymore.
if the words are changing, you must rewrite to action block
to -> the
Andreas
24-Mar-2010
[1748x3]
Yes, but SELF shouldn't be there at all, it's only leaking through 
from the implementation.
Otherwise, SELF should also be there in all other contexts (pun intended)
I.e. I can make the same arguments regarding `apply closure [x] [self] 
[42]`, which behaves differently from the MAP-EACH example.
Steeve
24-Mar-2010
[1751]
actually, it is everywhere.
BrianH
24-Mar-2010
[1752]
I like the trick for conversion of records from fixed block spans 
to objects, both for Steeve's example and for passing along to functions 
that take object! records. However, as Andreas says we don't need 
the 'self binding trick to do it, we can use the bind? function.
Steeve
24-Mar-2010
[1753x2]
(except in functions :)
Yep I agree, but mine is more Rebolish, that's all :)
Andreas
24-Mar-2010
[1755]
It's not more rebolish if it is buggy.
BrianH
24-Mar-2010
[1756]
It is rebolish, but the use case is more rare than regular usage 
of 'self to refer to the outer object context. And BIND? is also 
rebolish :)
Andreas
24-Mar-2010
[1757]
Ignore that last remark, please.
Steeve
24-Mar-2010
[1758]
Buggy ? what a word to say between gentleman
Andreas
24-Mar-2010
[1759]
(My last remark, that is.)
Steeve
24-Mar-2010
[1760]
lol
BrianH
24-Mar-2010
[1761]
Actually, the BIND? trick works for all loop contexts but not for 
object contexts, which might have no fields. And it wouldn't work 
for closures with no parameters, but there is no point to those anyways 
so who cares :)
Andreas
24-Mar-2010
[1762]
bind? is the new self :)
BrianH
24-Mar-2010
[1763]
Except for objects, for the reason I mentioned above.
Andreas
24-Mar-2010
[1764x2]
bind? 'self will work for objects, no :) ?
(Just kidding :)
BrianH
24-Mar-2010
[1766x2]
Please bring up the BIND? trick in a comment to bug#1529.
These conversations in AltME are fun, but unless they are in blog 
comments, chat or CureCode they have no effect.
Andreas
24-Mar-2010
[1768]
Yeah, I'll add a remark later on, but I gotta run now. Take care.
Steeve
24-Mar-2010
[1769]
Carl is Altmeproof
BrianH
24-Mar-2010
[1770x3]
There's too much here. He can't afford to read all of this crap. 
He needs someone to summarize for him, and to put it somewhere that 
won't scroll off the screen.
Ok, Andreas, I'll add it for you and attribute it to you. I'm working 
on this stuff now :)
Steeve, I couldn't find your comment in CureCode bug#1529. Where 
did you post it?
Steeve
24-Mar-2010
[1773x2]
Sorry, i posted it on the blog
wrong place it seems
BrianH
24-Mar-2010
[1775x2]
Yeah, we've played out the conversation there. Too many comments 
there already.
All right, fine, I'll post your code in CureCode and attribute it 
to you. And Andreas' code too.
Gregg
24-Mar-2010
[1777]
...I cannot predict the behaviour of Bind unless I know the originator 
of the context.

 This seems like a core question to me. And while Steeve's example 
 is really neat, I wouldn't say it is REBOLish per se. BIND? doesn't 
 say a whole lot more, so I don't think either example is something 
 to hold up as a best practice. :-)


Is it by design? If so, how is it intended to be used, and how should 
it *not* be used? If not, what warnings do we need to include in 
docs?
BrianH
24-Mar-2010
[1778]
Well, when you consider that MAKE closure! also originally did the 
'self trick and now doesn't, it appears to be accidental.
BrianH
25-Mar-2010
[1779]
Comments from Steeve and Andreas posted to CureCode #1529.
Steeve
25-Mar-2010
[1780]
Thanks Brian
BrianH
25-Mar-2010
[1781]
And look at #1543 as well.
Steeve
25-Mar-2010
[1782]
bind/trick ? :)
BrianH
25-Mar-2010
[1783x2]
That's the default behavior :)
Usually we use /only to mean /no-tricks, but /only is already used 
by BIND for something else.
Steeve
25-Mar-2010
[1785]
so, bind/neat :)
BrianH
25-Mar-2010
[1786]
I used /no-self because it's similar to the /no-copy used elsewhere. 
Any other practical suggestions?