World: r3wp
[!REBOL3]
older newer | first last |
Pekr 28-Apr-2010 [2382x3] | Does the situation also change because on some new models to R3, as e.g. separated user/script/module contexts etc.? |
I don't undersand all the fuss about the 'self :-) Is your and Ladislav's point of view really so different here? :-) | |
... and also - does Carl's new doc provide you with some explanation, how actually 'self is handled in various situations? | |
BrianH 28-Apr-2010 [2385x2] | Not really. But the change in function evaluation affects it somewhat. |
Carl's doc is too high-level to be helpful here. His list of tests is better, but still incomplete. | |
Pekr 28-Apr-2010 [2387] | Carl put temporary decision to the 'self case ... we are probably very close to A98 release ... |
BrianH 28-Apr-2010 [2388] | Looks like the argument has been settled. Good for us :) |
Pekr 28-Apr-2010 [2389x2] | A98 released - see R3 Chat ... |
sorry, marked as A97, Core only, for the purpose of 'self testing ... | |
Maxim 28-Apr-2010 [2391] | wow that 'self topic has become pretty intense. just one question left... what color gloves (boxing) are Brian and Ladislav wearing? ;-) |
BrianH 28-Apr-2010 [2392] | Hey, I did my best to express his point in a timely manner in a way that would be understood, same as with the opposing points. There was a lot of discussion that had to be gotten across quickly to Carl, so that he could make a final ruling. And it looks like a refined version of Ladislav's proposal was chosen. So we did a good job :) |
Ladislav 28-Apr-2010 [2393] | my gloves are blue, Max (I live in a Blue Street) |
Maxim 28-Apr-2010 [2394] | hehe... fighting with gloves ON is ok (that was my point btw. ;-) |
BrianH 28-Apr-2010 [2395x3] | The 'self test doesn't seem to be working as expected so far, at least for closures and loops. Weird. |
Ladislav, for comparison I added the tests from the blog to #1543, #1544 and #1549. Take a look and tell s what you think. English is overrated - clearly, we should be expressing our arguments in REBOL :) | |
tell s -> tell us | |
Ladislav 28-Apr-2010 [2398] | Right,Brian, in REBOL it usually is less ambiguous, that is why the Bindology article contains that much Rebol code |
BrianH 28-Apr-2010 [2399x3] | I added your philosophical point tests to the example code of the #1549 ticket, and the practical tests to a comment. Please check both. |
And test them against the build linked above, to see whether they match. There doesn't seem to be a SELFLESS? function yet, so the downsides of the proposal haven't been resolved yet by the posted build. | |
In the posted build, functions are fixed, but closures and loops aren't yet. | |
Ladislav 28-Apr-2010 [2402x3] | If my last tests are more understandable, then I am able to simplify the #1549 wording by removing older text, etc. keeping and explaining only the newer tests |
does that make sense? | |
BTW, I wanted to edit the TO-BINARY function description in R3 documentation to explain the "network bit order", but did not succeed; while I edited some parts of the documentation, now I am unable to log in, and have no idea why (posted a private MSG to Carl in R3 chat, but he may have missed the message?) | |
BrianH 28-Apr-2010 [2405] | Sure. Btw, your philosophical tests pass now, at the expense of other bugs continuing, including the return of #447. The practical tests show the errors in question. Basically, #447, #1528 (for closures), #1529 and #1552 are still problematic. |
Ladislav 28-Apr-2010 [2406] | Is there somewhere I can get A98? |
Graham 28-Apr-2010 [2407] | We are all asking that |
BrianH 28-Apr-2010 [2408] | Updated the practical tests to explicitly test for the missing fixes (except #1552). Go to R3 chat for the link to the build. |
Ladislav 28-Apr-2010 [2409] | OK |
Pekr 28-Apr-2010 [2410x2] | there is no A98, just A97 core, the link is in R3 Chat ... |
http://www.rebol.com/r3/downloads/r3c-a97.exe | |
BrianH 28-Apr-2010 [2412] | I was trying to avoid posting that link in a web-public forum. |
Pekr 28-Apr-2010 [2413] | yes, but why? |
BrianH 28-Apr-2010 [2414] | Don't know :) |
Pekr 28-Apr-2010 [2415] | OK, so I solved it then :-) |
BrianH 28-Apr-2010 [2416x2] | (From chat #7216) Some tests pass, others fail. It's a good start. - The tests in the example code of bug#1549 pass (Ladislav's philosophicals) - The practical tests don't. In particular, bug#447, bug#1528 (for closures), bug#1529 and bug#1552 are still problematic. - We need a SELFLESS? function (or whatever it should be called) to resolve the main downside of the #1549 approach, and we need it for the a98 release. Here are the practical tests that need to pass: ; Objects ob: object [] print same? ob do bind [self] ob print same? ob do in ob [self] ; Functions ob: object [f: func [/x] [do bind/copy [self] 'x]] print same? ob ob/f ; Can't use the context after the function returns. ; This is not a side effect of Ladislav's proposal. ; Functions with a 'self parameter (#1528) ob: object [f: func [/self] [do bind/copy [self] 'self]] print not same? ob ob/f ; Closures (#447) ob: do closure [x] [bind? 'x] 1 print 1 = ob/x print not same? ob do bind [self] ob print not same? ob do in ob [self] ; Closures with a 'self parameter (#1528) ob: do attempt [closure [self] [bind? 'self]] 1 print 1 = attempt [ob/self] print not same? ob do bind [self] ob print not same? ob do in ob [self] ; Closures shouldn't bind 'self unless it is a parameter (#447) print same? self do closure [x] [self] 1 print not same? self do attempt [closure [self] [self]] 1 ; Loops (#1529) ob: repeat x 1 [bind? 'x] print 1 = ob/x print not same? ob do bind [self] ob print not same? ob do in ob [self] ; Loops with a 'self variable (#1529) ob: repeat self 1 [bind? 'self] print 1 = attempt [ob/self] print not same? ob do bind [self] ob print not same? ob do in ob [self] ; Loops shouldn't bind 'self unless it's a variable (#1529) print same? self repeat x 1 [self] print not same? self repeat self 1 [self] See also #1552: There needs to be a way to distinguish selfless contexts from selfish contexts at runtime (a SELFLESS? function), and selfless contexts need to MOLD into DOable syntax (perhaps a different datatype, or a flag). |
New test build, all of Ladislav's and my tests pass. Success, and agreement, yay! | |
Ladislav 29-Apr-2010 [2418x2] | selfless?: func [context [word! object!]] [ make object! [ myself: 'self return same? myself first bind [self] context ] ] |
>> selfless? make object! [] == false >> repeat i 1 [selfless? 'i] == true | |
Rebolek 29-Apr-2010 [2420] | >> upgrade Fetching upgrade check ... ** syntax error: script is missing a REBOL header: http://www.rebol.com/r3/upgrade.r |
Ladislav 29-Apr-2010 [2421x5] | >> f: func [/local x] [selfless? 'x] >> f == true >> f: closure [/local x] [selfless? 'x] >> f == true |
>> selfless? 'rebol == false | |
if we want to have the function faster, this version should suffice: make object! [ set 'selfless? func [context [word! object!]] [ return same? 'self first bind [self] context ] ] | |
optimized: make object! [ set 'selfless? func [context [word! object!]] [ 'self =? first bind [self] context ] ] | |
as it looks, this optimization was "too much", since the function modifies itself, so either we need to always create a new object, like above, or use BIND/COPY at least: make object! [ set 'selfless? func [context [word! object!]] [ 'self =? first bind/copy [self] context ] ] | |
BrianH 29-Apr-2010 [2426] | Thanks, I'll modify the ticket accordingly :) |
Ladislav 29-Apr-2010 [2427] | yes, I found out, that you actually wrote the function in CureCode; is the 'self argument already accetable in functions? |
BrianH 29-Apr-2010 [2428x2] | Yes. All of both our tests pass now in the new build. |
And your version is more secure than mine, which used DO rather than FIRST. | |
Ladislav 29-Apr-2010 [2430] | if the 'self argument is acceptable, then I probably do not have the same version as you do |
BrianH 29-Apr-2010 [2431] | I use /local self. I was talking about your 'self =? first bind/copy [self] context vs. my self =? do bind/copy [self] context Mine has a code-injection risk. |
older newer | first last |