World: r3wp
[Core] Discuss core issues
older newer | first last |
Ladislav 3-Nov-2010 [320x3] | Do you have any problem with it? |
(you should not) | |
Of course, this construct is just for R2, for R3 you have native solution | |
Anton 3-Nov-2010 [323] | No, just wondering. |
Ladislav 3-Nov-2010 [324x4] | A different idea, instantly causing any R2 cycle to "understand continue": cc: func [ {convert a cycle body to "understand" CONTINUE} body [block!] ] [ compose/only [catch/name (body) 'continue] ] continue: func [[throw]] [throw/name none 'continue] ; usage: for n 1 5 1 cc [ if n < 3 [continue] print n ] |
Hope, this is sufficient even for Graham ;-) | |
Any name improvements (the 'cc name looks a bit unnatural) | |
? | |
Anton 3-Nov-2010 [328x2] | Could you put CONTINUE into the CC func context? |
(I mean, wouldn't it be better ?) | |
Ladislav 3-Nov-2010 [330] | yes, that can be done |
Anton 3-Nov-2010 [331] | Ah, but then you need to bind BODY. |
Ladislav 3-Nov-2010 [332] | no problem with that, but it would be incompatible with R3 CONTINUE, then |
Anton 3-Nov-2010 [333x3] | oh I had forgotten it was in R3. |
better outside then. | |
CC -> MAKE-CONTINUABLE ;) | |
Ladislav 3-Nov-2010 [336] | Very understandable, but a little bit too long for my taste |
Anton 3-Nov-2010 [337] | I can't think of a better name. The reason is because it shouldn't be there at all. I think all the rebol loop constructs should be adjusted to use CC by default. |
Ladislav 3-Nov-2010 [338] | All REBOL loop constructs use CONTINUE, but, unfortunately, not in R2 :-( |
Anton 3-Nov-2010 [339] | Well, there's a wish... |
Ladislav 3-Nov-2010 [340] | I don't think you get CONTINUE in R2, if you don't want this "cheap one" |
Anton 3-Nov-2010 [341x2] | Hmmm... hard decision. |
On the balance of things, I think it would make things better; code more readable and more consistent with R3 code, so I'm for it. A better name for CC is definitely needed, though. | |
Ladislav 3-Nov-2010 [343] | What amazes me, (as always in REBOL) is, that the hardest part is to find the best name, not to implement the feature :-) |
Anton 3-Nov-2010 [344] | Well, that just means that the name of a feature is really part of the feature. |
Ladislav 3-Nov-2010 [345x2] | Regarding the CONTINUE in R2 - I may be wrong, though, maybe Brian would know better? |
But, of course, Carl would know best! | |
Anton 3-Nov-2010 [347x2] | What do you mean "Regarding the CONTINUE in R2" ? |
That you think it's not implemented in any loop construct (even under a different name) ? | |
Ladislav 3-Nov-2010 [349x2] | I wrote: "I don't think you get CONTINUE in R2". the above is just explaining, that I may not be the one knowing the policy in this respect |
replace "get CONTINUE" by "get native CONTINUE" to make it more understandable | |
Anton 3-Nov-2010 [351x2] | Ah yes. |
Well... I think we should still aim high and make a wish. | |
Ladislav 3-Nov-2010 [353x4] | Sure |
How about a C-AWARE name, it looks a bit shorter, would it sill be acceptable? | |
sill: :still (pardon the typo) | |
http://www.rebol.org/view-script.r?script=c-aware.r | |
Gregg 3-Nov-2010 [357] | CC makes me think of "Call with Continuation", but I agree that MAKE-CONTINUABLE is a little long. Just CONTINUABLE? Without 'continue in the name somehow, even if abbreviated, you lost the connection to the keyword. |
Rebolek 3-Nov-2010 [358] | It would be nice to have /PART refinement for SWAP. |
Pekr 3-Nov-2010 [359] | CC is also commonly known in digital photo area as Comment & Critique .... |
BrianH 3-Nov-2010 [360x5] | Ladislav, your request to make HALT catchable was in CureCode already as #1520. Please add your concerns in a comment there. That ticket needs a use case to catch HALT in addition to everything else. |
According to that use case CATCH/all would catch QUIT/now as well - you should mention that too. | |
There is no need to worry about the name CC - it won't be used. A CATCH option is more likely. | |
Oh, nevermind about the CC. I missed the change in subject :) | |
CONTINUE is more likely to be added as a native in R2 than it is as a hack. We already have BREAK, so the mechanism is there. | |
Maxim 3-Nov-2010 [365] | use case is simple to catch halt... make sure sandboxed code doesn't stop the interpreter. same for quit/now. only the outer app should be allowed to use those. |
BrianH 3-Nov-2010 [366] | Right, but the top-level script *is* the outer app, so these need to be made available at least at that level. |
Maxim 3-Nov-2010 [367] | yes... which is why putting a catch/all when executing code in a sandbox (I often use CONTEXT [ ] to do so) is very usefull to prevent the outer script from halting or quiting because of some externally loaded code.. |
BrianH 3-Nov-2010 [368] | If MAKE object! specs catch RETURN and EXIT, that's an error. |
Maxim 3-Nov-2010 [369] | I don't think it does. |
older newer | first last |