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

World: r3wp

[!REBOL3]

Steeve
25-Mar-2010
[1850]
yep but it means more work and more potential regressions
BrianH
25-Mar-2010
[1851]
Yeah, it's not R2 compatible either (which isn't necessarily a problem, 
but still).
Ladislav
25-Mar-2010
[1852]
Not really, at least not for datatypes that depend on binding, like 
objects, functions and closures. REBOL's definitional binding model 
(I used to call it 

applicative binding") makes that syntax not really work properly. 
Bindings are not restored by the MOLD/all serialized LOAD syntax. 
Regardless of whether there is a hidden 'self field or not, you need 
to create it with MAKE syntax in order to get the bindings restored 
properly." - this is a different, and quite interesting issue. As 
far as I can tell, this objection applies to any LOAD MOLD/ALL combination 
used, though.
BrianH
25-Mar-2010
[1853]
Yup. But it only really affects objects, functions and closures. 
Most types aren't affected by binding issues, and the other main 
type that is - modules - can't be serialized in a restorable form 
at all.
Ladislav
25-Mar-2010
[1854]
People who need the 'self binding sometimes with a context, and don't 
need it other times with *the same context*.

 - this is the issue in a crystal clear form. As far as I am concerned, 
 I need to bind every block supplied to the Bind function to be bound 
 the same way, when the same context is given, because I need the 
 code to behave consistently. Therefore, I dislike the state, when 
 I do not know, what "the same way" is. As opposed to that, you seem 
 to prefer to bind blocks differently, even when they are bound to 
 the same context, which seems to be necessary only in case, when 
 the usual contexts have to contain, as I call it "unsolicited" 'self.
BrianH
25-Mar-2010
[1855]
I only need to bind blocks differently to the same context *when 
I tell it to do so* (aka, when solicited). This is so I can write 
code that expects 'self to be bound without having to check whether 
the object I am binding to has the hidden 'self field. If I had to 
check for that, I would have to do that check with every usage of 
BIND where I had a 'self reference and use different code blocks 
depending on the results of that check. It is much better for BIND 
to just do what I tell it to do.
Ladislav
25-Mar-2010
[1856]
Regarding the Steeve's point: as far as I am concerned, your suggestion 
*is* consistent. (I see it as more consistent, than the current state) 
The only problem with it is, that some users may find it uncomfortable, 
since they do not need to have 'self related to e.g. Repeat, or other 
cycle functions...
BrianH
25-Mar-2010
[1857x2]
Ah, but that's a separate issue than the BIND/self vs. BIND/no-self 
thing. BIND already has the option, internally, accessible by native 
code, to not unhide and bind 'self. And the loop functions can already 
use that option, and should: They shouldn't override  'self bindings 
unless 'self has been overriden with another, unhidden 'self field.
I definitely agree with that one :)
Ladislav
25-Mar-2010
[1859]
People who need the 'self binding sometimes with a context, and don't 
need it other times with *the same context*.
 - please, exclude me from the set of People, then.
BrianH
25-Mar-2010
[1860]
Sure. That's why we have options :)
Steeve
25-Mar-2010
[1861]
too late Ladislav, your "self" is already bound
Ladislav
25-Mar-2010
[1862x2]
LOL
...nevertheless, I need not worry, since there is an option...
BrianH
25-Mar-2010
[1864x3]
And note that the 'self trick only applies to the special hidden 
'self field. And overrides of that field aren't affected: They will 
be bound or not, normally, depending on whether they are themselves 
hidden. And BIND/self shouldn't show a overriden 'self field if it 
is hidden - it should show the original 'self. Does that make sense?
And overrides -> Any overrides
Hidden fields are weird.
Steeve
25-Mar-2010
[1867]
Well Brian, Your words have no self meanings outside this discussion 
either
BrianH
25-Mar-2010
[1868]
Very existential of you: self has no meaning :)
Steeve
25-Mar-2010
[1869x2]
until it's bound to something
to a context for instance
BrianH
25-Mar-2010
[1871]
I feel like that sometimes whenever I'm single.
Steeve
25-Mar-2010
[1872]
too selfish :)
BrianH
25-Mar-2010
[1873x2]
The funny part of all this is that if the "hidden 'self field" is 
mandatory and not modifiable, R3 doesn't necessarily have to have 
a physical field to store it: It could be implicit. It's just a matter 
of whether having the physical field there is more efficient to implement 
than an implicit field (which I suspect it is).
Oh, Ladislav, you're going to hate this worse that THROW not throwing: 
What we call "contexts" in REBOL aren't contextual :)
Steeve
25-Mar-2010
[1875]
well in R2 it is explicit and modifiable
BrianH
25-Mar-2010
[1876x2]
well in R2 it is explicit and modifiable
 And a security hole because of this.
(Did I just say that out loud? Stupid web-public groups.)
Steeve
25-Mar-2010
[1878]
I must admit, I don't really understant that claim. Why is it a security 
hole ?
BrianH
25-Mar-2010
[1879x2]
Because 'self is *used*, by code that expects it to refer to the 
same object that it is bound to. So if it is changed to refer to 
another object, that code fails. And if that change of referent is 
carefully done on purpose it can break the code in ways that it wouldn't 
detect. And that can be bad in some cases. Admittedly, it's not a 
big hole. BIND? doesn't have this problem: It doesn't return self, 
it returns the real context reference.
BIND? was originally added to R2 to deal with that security problem 
- we used to use 'self more often. And in R3 the 'self is protected, 
and not unprotectable by UNPROTECT in a special case. So it's not 
just BIND that special-cases 'self.
Ladislav
25-Mar-2010
[1881]
And once the context is created and extends beyond the function of 
its initial creation, there is no standard for which is more common.

 - actually, there is a standard, successfully used in R2: always 
 do the same, which is both consistent and "what is needed", since 
 that is, what the programmer asked for
Steeve
25-Mar-2010
[1882]
Amen
BrianH
25-Mar-2010
[1883]
Ah, but in R2 those contexts were broken when they extended beyond 
the life of the function that created them. The first field was treated 
like 'self, and hidden.
Steeve
25-Mar-2010
[1884]
I like reading the scriptures.
The Gospel according to St. Ladislav.
BrianH
25-Mar-2010
[1885x5]
And the programmer that matters when it comes to BIND is the one 
that is calling BIND, and providing the code block. Not the one that 
made the context. It's different with internal use of BIND, functions 
that make, use and discard a context. If the context persists then 
it needs to behave in a predictable matter. R2 is not a good example 
to cite when deciding what is good coding practices; we made the 
decision to change things in R3 for *many* good reasons.
If the context persists then it needs to behave in a predictable 
matter.

  - and I mean predictable by someone who didn't make the context in 
  the first place.
Otherwise we won't be able to write generic code that works with 
all contexts.
And once again, I regret that we decided to use the term "context" 
so badly here in the REBOL community. It's really inappropriate.
It's much better to call them objects; the Lisp community calls them 
environments.
Ladislav
25-Mar-2010
[1890x3]
And the programmer that matters when it comes to BIND is the one 
that is calling BIND, and providing the code block. Not the one that 
made the context.

 - this is interesting, again. My note is, that if the context was 
 created to support e.g. the functionality of For, then any subsequent 
 binding is meaningful for me, only if the functionality remains supported. 
 I think this way, even when I am the one calling Bind and providing 
 the block, unfortunately, I may not know, which alternative mentioned 
 by you to use, not knowing the type of the context I obtained.


As opposed to that, when I see a context without 'self, I know, that 
the context was created so, that it is not meant to support 'self 
binding, and that is all I need to know. How would you do it obtaining 
a context of unknown origin, that would contain '"unsolicited" self? 
(of course, not knowing that information, since there is no way how 
you can find that out)
I meant the above as a contribution to the "predictability" issue 
- how can you predict, whether the block would behave as originally 
intended, not knowing, what the original intent was?
(unfortunately, the same objection applies to #1544, since then, 
again, "the original intent" is lost)
BrianH
25-Mar-2010
[1893x2]
Generic functions that work on objects don't see the code that originated 
them. They can only tell how the objects are supposed to behave with 
their own code. Original intent was contextual (using the term correctly 
this time). Current behavior is a different context.
It's like that quote from The Incredibles: "I know what I said before! 
Listen to what I'm saying *now*."
Ladislav
25-Mar-2010
[1895]
I provided above a specific example, that demonstratd clearly what 
I meant. The support for code like that is missing in R3 and remains 
missing, even if any of #1544 or #1543 will be accepted.
BrianH
25-Mar-2010
[1896x3]
What you want is for objects created by loops and functions for their 
local variables, but persisting after their creators are finished 
with them, to *break* all other code that expects objects to behave 
like objects. Same as in R2. It was a bad idea in R2 (which we can't 
fix) and it's a bad idea in R3.
This is what we get for calling objects "contexts": It makes us think 
they are contextual, when they aren't.
If you don't like the hidden 'self field in objects in R3, fine, 
but it was a fix to major problems in R2. Problems we don't want 
to come back.
Ladislav
25-Mar-2010
[1899]
...to *break* all other code that expects objects to behave like 
objects...

 - this has been demonstrated by Andreas to be false - I do not want 
 to break any behaviour of objects, I do want to not break behaviour 
 of other contexts than objects