AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 64 |
r3wp | 928 |
total: | 992 |
results window for this page: [start: 701 end: 800]
world-name: r3wp
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public] | ||
Dockimbel: 6-May-2011 | AFAIR, mod-action is required for mod-rsp. bind-extern RSP .r is required to send .r scripts to the RSP handler in workers. | |
onetom: 6-May-2011 | so, if there is no bind-extern RSP [ .r ] then where are the .r files get executed? within the main cheyenne process? | |
Dockimbel: 6-May-2011 | onetom: They should be just served as a static resource if the 'bind-extern directive is not used. | |
Dockimbel: 7-May-2011 | what exactly is the purpose of the overwritten 'do function in the RSP handler? Bind the loaded code to a special per-webapp context. | |
Dockimbel: 7-May-2011 | do* == do/global == native 'do There are cases where you want to bind your code to global context, so you will use 'do/global. For all other cases, you should just use 'do (especially now that nested 'do should to be fixed). | |
Group: Profiling ... Rebol code optimisation and algorithm comparisons. [web-public] | ||
Steeve: 30-Oct-2009 | A thing should be noted. repeat and foreach do a bind/copy of the evaluated block. Even if they are the fastest loops, they should be not used too intensivly because they will polluate the memory. It's particularly sensitive for graphics applications or services that linger in memory. So, that's why I advise to use only LOOP, WHILE and UNTIL for intensive repeated loopings, if you don't want to blow up the memory used by your app. | |
Group: !REBOL3 Schemes ... Implementors guide [web-public] | ||
Graham: 9-Jan-2010 | how does this work? switch event/type bind | |
Andreas: 9-Jan-2010 | (i'll get to the bind in a second, bear with me) | |
Andreas: 9-Jan-2010 | re the bind: i store the stuff the awake handler needs in order to work in port/locals | |
Andreas: 9-Jan-2010 | as a context. with the bind i can make those values appear as if they were local words, i.e. buffer refers to event/port/locals/buffer | |
Graham: 19-Jan-2010 | 2010.01.19 22:43:38 LOG5[4624:1256]: stunnel 4.29 on x86-pc-mingw32-gnu with OpenSSL 0.9.8l 5 Nov 2009 2010.01.19 22:43:38 LOG5[4624:1256]: Threading:WIN32 SSL:ENGINE Sockets:SELECT,IPv6 2010.01.19 22:43:38 LOG5[4624:5260]: No limit detected for the number of clients 2010.01.19 22:43:38 LOG3[4624:5260]: Error binding imaps to 0.0.0.0:993 2010.01.19 22:43:38 LOG3[4624:5260]: bind: Permission denied (WSAEACCES) (10013) 2010.01.19 22:43:38 LOG3[4624:5260]: Server is down | |
Group: !REBOL3 ... [web-public] | ||
BrianH: 7-Feb-2010 | make function! [spec body] doesn't copy the spec or body, it just uses them (or does a BIND/copy, I'm not really sure). If that spec or body contains literal values that get modified later, they get modified in the function as well. | |
BrianH: 15-Feb-2010 | So in your example, mytemplate/release wouldn't be able to get the bindings of 'clear and 'blk from the calling context, since there isn't one. In order for the template to know what context to bind those words, a reference to that context would have to be passed as a parameter. The way that nested contexts are emulated in REBOL is through iterative overrides, not real nesting. Making template! a datatype wouldn't help with this - it's part of the core semantics of REBOL. This is the same reason why the script or module Needs header can know what the target context to bind or resolve to is, but the IMPORT function can't. | |
Paul: 16-Feb-2010 | So the mytemplate would be the word that gets bound to the context. mytemplate/release is just a way of telling it BEFOREHAND what block to bind to the word. | |
Ladislav: 18-Feb-2010 | In R2 I could write: in object 'self, but no longer in R3. What's the equivalent in R3? - I do not understand all that "harakiri" going on in R3 with 'self. Nevertheless, the expression: first bind [self] object works | |
Ladislav: 18-Feb-2010 | Nevertheless, I think, that the fact, that first bind [self] object] works, while in object 'self does not, is at least surprising. What is that good for? | |
BrianH: 20-Feb-2010 | Ladislav, objects don't have a 'self field in R3 - the 'self binding is a side-effect of the BIND function. You shouldn't be using IN object 'self in R2 either - use BIND?. | |
BrianH: 22-Feb-2010 | So to discourage that behavior, 'self is hidden as-if with PROTECT/hide (effectively, not really), blocked from modification as-if with PROTECT (effectively, not really), not counted by LENGTH?, not unprotectable by UNPROTECT and only referenceable through BIND block! any-object!. It is unknown by anyone other than Carl whether the field actually exists in the object at all - I would guess that it does, because the alternative seems more complex and that's not his style. In any case, every reasonable effort has been made to discourage its use in any way except in code like Paul demonstrates above. R2's usage of the word was a security hole, and unnecessary once we got the BIND? function, both in R2 and R3. | |
BrianH: 4-Mar-2010 | Andreas, I don't have a problem with that solution in principle. It's just that it wouldn't work, and wouldn't be task-safe. The handlers for those functions would be task-local, the code blocks not. Plus it would break code that uses code block references rather than nested blocks, code that uses those functions through function values, and any function with the [throw] attribute (which we will be getting back in R3 with different syntax), and all of those exist in R3 mezzanine code. Plus there's all the extra BIND/copy overhead added to every call to loop functions, startup code, etc., and don't think that you won't notice that because that can double the memory usage and executiion time, at least. The solution I proposed in the ticket comments is to have DO, CATCH and the loops set a task-local flag in the interpreter state when the relevant functions become valid, and unset it when they become invalid, then have the functions check the flag at runtime before they do their work (which they could because they're all native). This would be task-safe, only add a byte of task-local memory overhead, plus the execution overhead of setting and getting bits in that byte in a task-local way. It's the execution overhead that we don't know about, whether it would be too much. It would certainly be less than your proposal though. | |
BrianH: 4-Mar-2010 | It might be hard to believe, but R3 has gotten so efficient that BIND/copy overhead is really noticeable now in comparison. In R2 there were mezzanine loop functions like FORALL and FORSKIP that people often avoided using in favor of natives, even reorganizing their algorithms to allow using different loop functions like FOREACH or WHILE. Now that all loop functions in R3 are native speed, the FORALL and FORSKIP functions are preferred over FOREACH or FOR sometimes because FOREACH and FOR have BIND/copy overhead, and FORALL and FORSKIP don't. The functions without the BIND/copy overhead are much faster, particularly for small datasets and large amounts of code. | |
BrianH: 4-Mar-2010 | Most of the time, actually, otherwise the BIND/copy overhead would make it a poor optimization. | |
BrianH: 4-Mar-2010 | That means that the BIND/copy overhead for BREAK and CONTINUE would happen at every call to a loop function, not just FOR, FOREACH and REPEAT. And 'break and 'continue would become keywords rather than function names, unable to be used for loop-local variables. | |
BrianH: 4-Mar-2010 | LOOP, WHILE, FORALL and FORSKIP don't currently have BIND/copy overhead. Which is why they are used a lot in R3 :) | |
Andreas: 4-Mar-2010 | The added BIND/copy overhead for loop functions currently not needing to BIND their body is certainly true. FOREVER would be another one of those. | |
BrianH: 4-Mar-2010 | REMOVE-EACH and MAP-EACH already have the BIND/copy overhead though. | |
BrianH: 4-Mar-2010 | But all the loop functions that take a word argument have BIND/copy overhead, and the rest don't. | |
Gabriele: 5-Mar-2010 | Andreas: what you ask for has been discussed extensively when R3 was started, by me, Ladislav and Carl. There are a number of disadvantages to that, starting from the fact that you need to bind/copy a lot more than you do now (eg. inside CATCH). It would also, unfortunately, not work in cases like this: | |
BrianH: 6-Mar-2010 | Carl, if you make RETURN and EXIT definitionally scoped, it would help if the throw: attribute would disable that, so functions like USE would work properly. Also, please keep BREAK, CONTINUE and THROW dynamically scoped - most of the functions that they break out of don't do definition, so making them do so would add unwanted BIND/copy overhead. | |
BrianH: 16-Mar-2010 | It seems that functions don't bind 'self to the code block, but they do reserve it in the function spec. So that's a separate ticket. | |
BrianH: 16-Mar-2010 | And closures don't bind 'self anymore either (I now vaguely remember a ticket related to that). | |
BrianH: 23-Mar-2010 | Internally, there is none. Ladislav is proposing that the internal 'self field in the beginning of all contexts be made optional, with that option taken by MAKE object! (and as a side effect, modules), but not taken by contexts created by functions, closures and binding structural functions. As opposed to allowing the field to be overriden for that other stuff, and not doing the BIND trick with 'self in those cases (as we demonstrated we can do when that problem was fixed for closures). | |
BrianH: 23-Mar-2010 | Now bug#1529 is basically the same thing as bug#447, which was for closures: BIND is doing the special treatment of 'self where it shouldn't. And as bug#447 proves, you can shut that off with no difficulty (internally). | |
BrianH: 23-Mar-2010 | And functions and closures don't do the BIND trick with 'self, so that's not a problem. | |
BrianH: 23-Mar-2010 | I am suggesting that this ability to turn off BIND's special treatment of 'self be made available as a BIND/no-self option (or whatever else we decide to call it). This would allow us to write mezzanine functions that act like FOR and such, not necessarily in the sense of looping, but in the sense of not treating 'self weirdly. | |
BrianH: 23-Mar-2010 | Ah, but that is when you are *expecting* to override the context. Only advanced users expect FOR and such to override the context. And I don't see the problem: It's an easy fix, as was proved when the exact same fix was applied to MAKE closure! in bug#447. There don't need to be any structural changes; just flip a flag in BIND. | |
Ladislav: 23-Mar-2010 | there are two problems... - actually, not, there are more than these two problems, as you bind/no-self proposal illustrates, that is what I wrote in my comment | |
Ladislav: 23-Mar-2010 | In case of the Context function you are in a different situation, since you expect it to bind the word 'self | |
Ladislav: 23-Mar-2010 | this problem cannot be "cured" by bind/no-self, since it requires the user to always know, how he wants to bind the words in the block, while such an information is already "automatically available" (as can be proven in R2) | |
BrianH: 23-Mar-2010 | this problem cannot be cured" by bind/no-self, since it requires the user to always know, how he wants to bind the words in the block, while such an information is already "automatically available" (as can be proven in R2)" This is not true. In the case of USE, REPEAT, FOR, FOREACH, MAP-EACH and REMOVE-EACH we don't want the hidden 'self to be bound to the code block, but we *do* want the hidden 'self to be there in the context. In case the context persists beyond the execution of the function, it should be like a normal object context. The same goes for closures. Only for functions do the contexts not have indefinite extent (in R3) - they are stack-relative, so don't work beyond the return of the function. However, in the case of your proposal to not have the 'self in some contexts, there is no way to specify that option in MAKE object! syntax, so the user can't tell whether it is the case or not. This is similar to the map! case-sensitivity option - we can't do it because we don't have the syntax. And we don't want to have anything that affects behavior on non-blackbox types that we can't see in MOLD or MOLD/all. | |
BrianH: 23-Mar-2010 | Now BIND/no-self is just a proposal to make *an internal option that BIND already has* usable by mezzanine code (like USE). And we know that BIND has that option because MAKE closure! already uses it. And we also want that internal option to be used by REPEAT, FOR, FOREACH, MAP-EACH and REMOVE-EACH, the same way that it is used by MAKE closure!.. | |
Ladislav: 23-Mar-2010 | ''In the case of USE, REPEAT, FOR, FOREACH, MAP-EACH and REMOVE-EACH we don't want the hidden 'self to be bound to the code block, but we *do* want the hidden 'self to be there in the context." - yes some may want all Rebol contexts to be isomorphic with objects, erasing a (perceived by me as useful) information (whether the context is supposed to be handled using BIND or BIND/NO-SELF, when applied on a block), which is present in R2, where the simple usage of BIND always does the right thing. It surely is a matter of preferences, that is why I am asking other users, what is more natural for them. | |
Ladislav: 23-Mar-2010 | ''In the case of USE, REPEAT, FOR, FOREACH, MAP-EACH and REMOVE-EACH we don't want the hidden 'self to be bound to the code block, but we *do* want the hidden 'self to be there in the context." - yes some may want all Rebol contexts to be isomorphic with objects, erasing a (perceived by me as useful) information (whether the context is supposed to be handled using BIND or BIND/NO-SELF, when applied on a block), which is present in R2, where the simple usage of BIND always does the right thing. It surely is a matter of preferences, that is why I am asking other users, what is more natural for them. | |
BrianH: 24-Mar-2010 | Ah, but that's the problem. When that context is used by FOR, I want 'self to not be bound. However, if the context persists after the FOR returns then I want BIND to do the 'self trick with any subsequent use of that same context; this is what I mean by "like a normal object context". That inconsistency is "the right thing". Having BIND not do the 'self trick based on some hidden quality of the object is *bad*. It means that I can't predict the behavior of BIND unless I know the originator of the object, and in many cases that wold mean dataflow analysis. | |
BrianH: 24-Mar-2010 | I don't want REBOL to guess whether I would want BIND or BIND/no-self to be used: I've already said so, do what I say to do :) | |
Ladislav: 24-Mar-2010 | When that context is used by FOR, I want 'self to not be bound. However, if the context persists after the FOR returns then I want BIND to do the 'self trick with any subsequent use of that same context; this is what I mean by "like a normal object context". - yes, and that is, where our POVs differ - similarly as Brian, I do not want one thing: I do not want Bind to behave differently when used twice, since it is not the right thing in my opinion - it means, that I cannot predict the behaviour of Bind unless I know the originator of the context. are there any other opinions, than mine and Brian's on this? | |
Ladislav: 24-Mar-2010 | Brian does not want to Rebol to guess, but he actually forces it to do so - R3 now guesses, that you want to bind 'self, unless you say otherwise. In case of R2, that is not the case - Rebol does not guess, since it uses the context as defined by the user. | |
BrianH: 24-Mar-2010 | 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. | |
BrianH: 24-Mar-2010 | Or perhaps he hates the idea of a hidden 'self field, and the corresponding BIND trick :) | |
Gregg: 24-Mar-2010 | ...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? | |
Steeve: 25-Mar-2010 | bind/trick ? :) | |
BrianH: 25-Mar-2010 | Usually we use /only to mean /no-tricks, but /only is already used by BIND for something else. | |
Steeve: 25-Mar-2010 | so, bind/neat :) | |
BrianH: 25-Mar-2010 | But BIND is using /only to mean /shallow right now. | |
Ladislav: 25-Mar-2010 | one more example in hope, that it will be understandable enough. First, the description in words: we define a function obtaining a block of code, which uses e.g. a Repeat loop. During the loop, the Block argument shall be executed too, but bound to the loop context, to be able to use the loop variable (s). The code looks as follows: a-function: func [block [block!]] [ repeat i 1 [do-in-context block 'i] ] do-in-context: func [block [block!] context [word! object!]] [do bind block context] I hope, that everyone understands, that this may well be a part of a real-world application, but my example is minimized to contain only the constructs that illustrate the problem. Now, in R2 the block will be executed "in the right context", being able to use the cycle variable 'i. In R3, the block is executed "in the wrong context", since the 'self variable will be bound, which was unsolicited. | |
BrianH: 25-Mar-2010 | However, we *can* make it an option of BIND. It's already a binding option for natives, we just can't see it from REBOL code. | |
BrianH: 25-Mar-2010 | Now when it comes to our interests, they are aligned. I agree that loop functions shouldn't bind 'self (#1529), and that functions should allow self in their argument lists (#1528), and that people should be able to bind a block without binding 'self if they don't want to (#1543). I also agree that /no-self is a dumb name and don't have a better one that isn't taken. | |
Ladislav: 25-Mar-2010 | By "conflict of interests" I mean: 1) the interest to have seamlessly working loops, functions, closures, Use, etc. By "seamlessly" I understand "working without ever doing unsolicited 'self binding. 2) the interest to have a simple syntax for Mold/Load to describe these contexts As far as I am concerned, 1) is a priority for me, therefore I prefer to have a different syntax for this type of contexts. Another possible option, which *might* be considered as an alternative is, to have a /self refinement for Bind as in BIND/SELF, since that variant covers the minority of use cases (just objects and modules), but I doubt it cold be called "functionally clean" anyway, thus, probably still violating 1) | |
BrianH: 25-Mar-2010 | Make a counter proposal then, like I did with APPLY/only vs. RAPPLY. It's real simple: We both want the option, but disagree on the default. I already made a proposal for BIND/no-self. Make a counter proposal for BIND/self in CureCode. One will be chosen, the other dismissed. | |
Ladislav: 25-Mar-2010 | (Why "cripple" all these contexts so, that Bind has to do unsolicited work?) | |
BrianH: 25-Mar-2010 | Another datatype would work with MAKE syntax though. But it doesn't handle the most common case: People who need the 'self binding sometimes with a context, and don't need it other times with *the same context*. For that you need a BIND option. | |
BrianH: 25-Mar-2010 | :Why cripple" all these contexts so, that Bind has to do unsolicited work?" - The behavior of BIND is documented, so it is presumptuous of you to say that its behavior is "unsolicited" when it is behaving as it is documented to behave. It is much better to use the word "unwanted" here. It is clear that *you* don't want BIND to do the 'self unhiding trick, and if there's no way to turn that off then it is a problem for you, as a user of the programming language. So there should be an option, and maybe your preferred behavior should be the default. However, you as a language designer (this is a different you, btw) has to consider what other users want to do, and that won't necessarily be consistent with what you (as a user) would want to do. So you (the designer) make tradeoffs, balance concerns, look for the most common behavior, make sensible choices, and try not to mess up. And then finalize the behavior in a tool that only does what it's told to do, and document that tool's behavior (at least on the surface). Then you (as a user) can know that the tool is going to respond the way it is documented to do when you tell it to do something - for a tool, this is what it means to do what it is supposed to do :) | |
BrianH: 25-Mar-2010 | For instance, if BIND/self (#1544) is implemented, then I will have to add the /self option to every usage of BIND in DO, LOAD, IMPORT, DO-NEEDS, INTERN and MAKE-MODULE, and perhaps some other places in the mezzanine code as well. This is not a problem (really, it isn't) but it is better to do this now while the scope of the effects is still calculable. | |
BrianH: 25-Mar-2010 | BIND is one of the most core functions in REBOL. Any change to its semantics would have big impact, so should be done sooner rather than later. | |
BrianH: 25-Mar-2010 | I am starting to be in favor of BIND/self, mostly because BIND/no-self looks so stupid (I hate the name). YMMV :) | |
Ladislav: 25-Mar-2010 | 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 | 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. | |
BrianH: 25-Mar-2010 | 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. | |
BrianH: 25-Mar-2010 | 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? | |
BrianH: 25-Mar-2010 | 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. | |
BrianH: 25-Mar-2010 | 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. | |
Ladislav: 25-Mar-2010 | 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) | |
BrianH: 25-Mar-2010 | Andreas, agreed, the problem could be solved by having two types. But that's unnecessary, since we have a solution already that doesn't require another type. And the two-type solution wouldn't help with loops and closures unless BIND? returned an object type from words bound to the non-object type, because to do otherwise would break BIND. | |
BrianH: 25-Mar-2010 | Because even if we made BIND not do the 'self trick by default, we would still *need* to add the /self option, and that option would *need* to have a 'self field to do the trick with, *every time*. | |
Andreas: 25-Mar-2010 | While I'm not even sure that we would still need /self, I can't see where the problem is. BIND/self simply won't work on context!s | |
BrianH: 25-Mar-2010 | Because otherwise every code block we are binding with BIND/self would leak references to whatever binding 'self had already. | |
BrianH: 25-Mar-2010 | You have to assume that the 'self trick needs to be able to work with every "context" that you pass to BIND, even if BIND doesn't do the trick by default. Because the trick is necessary for a lot of code. And leaked 'self references can be a security hole, allowing access to otherwise encapsulated code. | |
BrianH: 25-Mar-2010 | Ah, but you were also assuming that BIND doesn't do or depend on the 'self trick. Try the function with BIND/self. | |
BrianH: 25-Mar-2010 | Make sure that DO-IN-CONTEXT uses BIND/self, depends on it, requires it. Then pass in a "context" created by a loop function. | |
BrianH: 25-Mar-2010 | It's all well and good to say that the current BIND does the 'self trick and you don't like that. But there is a lot of code that depends on that trick, so if you don't want to do it for your code, you better make that an option (perhaps the default one). | |
Andreas: 25-Mar-2010 | Where is the problem in doing bind/self for object! contexts and bind/no-self for context! contexts? | |
BrianH: 25-Mar-2010 | Andreas, yes, those. TO-MODULE would break utterly, for instance, no recovery possible, if BIND accepted contexts that didn't have 'self. | |
Steeve: 25-Mar-2010 | Btw, I felt uneasy when the first time I saw that code : a-function: func [block [block!]] [ repeat i 1 [do-in-context block 'i] ] do-in-context: func [block [block!] context [word! object!]] [do bind block context] Now i know why. It's a serpentine way for simply doing: >> repeat i 1 block Erf :) | |
BrianH: 25-Mar-2010 | Sure, that's what is done with function! contexts after the function returns. And one of the functions that can't handle them is BIND. | |
Andreas: 25-Mar-2010 | Fine, but this is precisely about BIND acception two different types of contexts and determining by their type wether if should do the self trick or not. | |
BrianH: 25-Mar-2010 | Don't you see, if BIND/self is the only way to see the 'self word at all, and that word is otherwise not visible, and BIND/self would require the existence of that word, then there is no point in having a separate datatype. The only code that could possible be affected by the existence or not of a 'self field could not possibly be used with that type, and all other code wouldn't be able to tell the difference. | |
BrianH: 25-Mar-2010 | It's an alternative that wouldn't work: We'd still need /self or /no-self. For that matter, BIND has that option already, internally. It can be used by native code only, for now. | |
Andreas: 25-Mar-2010 | Use context!s internally, wherever you are currently using object!s with bind/no-self | |
BrianH: 25-Mar-2010 | The suggestion to add /self or /no-self to BIND is only a suggestion to make a proven, already existing, already used internal option externally visible. | |
BrianH: 25-Mar-2010 | I don't see the point to another datatype which is *indistinguishable from object by all code that would accept it*. The only code that wouldn't accept it is BIND/self (the current BIND behavior). And BIND/self is the only way to see the 'self field at all - otherwise it basically is not there. | |
Andreas: 25-Mar-2010 | And it's not indistinguishable from all code accepting it; it makes a big difference to code that uses BIND. | |
Andreas: 25-Mar-2010 | And finally, you still don't see that this only makes sense as a combined proposal with adapting BIND to predicate behaviour on the type of context. | |
BrianH: 25-Mar-2010 | But no reason to - there would be no difference that you could detect. If you don't use BIND/self, you can't get access to the 'self word at all. So if you can't get access to the word, why would it matter if tit's there? | |
Andreas: 25-Mar-2010 | So it's really about: context! + object! + bind without /self or /no-self | |
Andreas: 25-Mar-2010 | And if that all matters is a question about how you assume typical BIND code to look like. Ladislav's point (at least as far as I understand it, Ladislav please correct me if I'm mistaken) is that there are situation in which I as BIND user don't know whether I want to do BIND/self or BIND/no-self on the context. | |
BrianH: 25-Mar-2010 | The situation where the user of BIND doesn't know whether to use /self or not, is a case of a non-programmer trying to program. REBOL doesn't try to solve that problem. | |
Andreas: 25-Mar-2010 | You categorically ruled ou that there is code where the user of BIND does not know (or care) whether SELF is of importance. Anything that follows after that is only begging the question. | |
Andreas: 25-Mar-2010 | In any case, adding a BIND/self refinement would certainly be an improvement over the current situation. | |
BrianH: 25-Mar-2010 | REPEAT et al doesn't need to have 'self be bound in its code block. But if a reference to the object created by REPEAT persists after the function ends, any subsequent use of that object would either need to use its 'self, or not see its 'self at all. REPEAT *can't* know which. If the object is used by any code that needs to see 'self (like BIND/self) then that 'self absolutely must be there, because the otherwise the 'self references in the code block would retain the bindings they had before, which will likely be encapsulated code in a module (this is R3, remember). If the object doesn't need to use 'self, *it can't*: The reflectors, the formatting code, and BIND without the 'self trick can't tell if there is a 'self there or not, so if it's not there it *would make no difference whatsoever*. So all you are proposing is to make a datatype that doesn't contain a hidden 'self field, but which can *only* be used in cases where there not being a hidden 'self field is something that doesn't affect it at all. | |
BrianH: 25-Mar-2010 | Yes, I like Ladislav's BIND/self proposal. The /self option would be used where 'self matters, and otherwise not used. Good balance to that. | |
BrianH: 25-Mar-2010 | You can do that now: The hidden 'self is overriden, and the 'self trick doesn't apply. Like this: ; Current behavior: >> a: construct [] == make object! [ ] >> append a [self: 1] == make object! [ self: 1 ] >> do bind [self] a == 1 >> protect/hide in a 'self == self >> do bind [self] a == make object! [ ] >> same? a do bind [self] a == true |
701 / 992 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | [8] | 9 | 10 |