World: r3wp
[!REBOL3]
older newer | first last |
Chris 6-Mar-2010 [1432] | ..should not be... |
Paul 6-Mar-2010 [1433] | But what if I'm not the one doing it. |
Henrik 6-Mar-2010 [1434] | Paul, you don't create services that carelessly evaluate data that is potentially manipulated by an attacker. That's a security hole and bad coding. That's one of the good things about dialects. |
Chris 6-Mar-2010 [1435] | Agreed, and that's what this is - a dialect - as Rebol's sop is chaining... |
Paul 6-Mar-2010 [1436x3] | I'm not saying to stop chaining am I? |
I'm saying to offer a case where we don't chain. | |
But obvoiusly you guys are not in favor of options. | |
Andreas 6-Mar-2010 [1439x2] | Why not also offer a case where we drop all strings encountered? |
Or a case where we double all integers? | |
Paul 6-Mar-2010 [1441x3] | Are the strings a concern? |
are single integers a concern? | |
We have build in code to handle those things don't we? | |
Andreas 6-Mar-2010 [1444x2] | Do we? |
I don't know of a construct refinement that drops all strings. | |
Paul 6-Mar-2010 [1446] | Then we just make sure they get assigned to the proper place don't we? |
Henrik 6-Mar-2010 [1447] | yes, we do. with PARSE and dialects. |
Andreas 6-Mar-2010 [1448] | And that's what you should do too, Paul. |
Paul 6-Mar-2010 [1449] | I do Andreas, I have to currently use more bloat just like all of us do to handle it. |
Andreas 6-Mar-2010 [1450x3] | That's not bloat, that's application specific code. |
And no, it's not "all of us", as none of us have those specific needs. | |
Just as you don't seem to have the need to drop all strings ... | |
Paul 6-Mar-2010 [1453x2] | bloat is in the eye of the beholder. To me where it takes more code to do something that could be done elsewhere is bloat in my book. |
You all have that need. | |
Henrik 6-Mar-2010 [1455] | if it made general purpose sense then it probably would be looked at, but with the amount of discussion here, how generic is it exactly? it helps with some code examples that significantly reduce the code size in a general way. |
Gregg 6-Mar-2010 [1456] | I vote against the proposed change to CONSTRUCT. I believe the need is better served with a mezz. If it becomes popular and useful, then consider making it part of the standard distro. |
Paul 6-Mar-2010 [1457x7] | I'll add the solution to another power type mezz package. |
Tbat is what is great about NO! | |
Anyone know how Lua handles this? | |
http://host4.altme.com/altweb/rebol3/chat771.html | |
sorry | |
wrong place to paste | |
trying to do a bit of marketing/advocacy | |
BrianH 6-Mar-2010 [1464x2] | There is a plan to create a library of community-supplied modules full of useful code that isn't generally useful; we've been calling it R3/Plus. Code that would go in /Plus is called library code, as opposed to code that gets built into R3 itself, which is called mezzanine code. Paul's suggestion seems like a good candidate to be library code. |
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. | |
Ladislav 7-Mar-2010 [1466x6] | I am not sure I understood the plan, is it so, that the plan is, to have two types of functions depending on an attribute: -functions with dynamically scoped Return/Exit -functions with definitionally scoped Return/Exit ? |
BrianH, definitonally scoped Return/Exit need not be disabled, it would "automatically" work as expected, that is the beauty of the approach | |
(my article discussing function attributes illustrates that) | |
http://www.compkarori.com/vanilla/display/Function-Attributes | |
What's the quickest way to detect R3 vs R2 for hybrid scripts? - see e.g. http://www.rebol.org/art-display-article.r?article=w24v | |
Note to the "Should we catch unwinds?" question in the http://www.rebol.com/r3/notes/errors.html article - the subject of the CureCode #1506 is, that it is (or should be) possible for the interpreter to find out, whether the unwind would cause a "No catch for throw" type error, and, that Try should catch such an "unhandled" unwind. | |
Gregg 7-Mar-2010 [1472] | Excellent article Ladislav. Thanks for taking the time to write that. |
BrianH 7-Mar-2010 [1473x2] | I wrote a few comments to the blog, explaining the advantages of the definitionally scoped RETURN and EXIT proposal. The optional function attribute we would need would not change them to dynamically scoped, it would just tell the function to not redefine RETURN and EXIT within, allowing them to keep their existing bindings. No dynamic scoping of those functions would be needed at all. |
Adjusted the wording of bug#1509 to reflect the new documentation of the unwind functions. | |
Geomol 8-Mar-2010 [1475] | (Continuing from "Rebol School".) I've thought about TRY/EXCEPT too, since it popped up a few days ago. My thoughts are more about design. Why do we have TRY? Why not make /EXCEPT a refinement of DO? DO can do any type, TRY only works on blocks. If you wanna do a script on the net, and it can go wrong, we have to write: try/except [do <url>] [<handle error>] With /EXCEPT on DO, it could be: do/except <url> [<handle error>] My point is: is it good to have all these words in the language? It may add depth, but it also add confusion and complexity. Maybe the depth could still be there with fewer words, and the language would be easier? |
Henrik 8-Mar-2010 [1476] | I don't miss a simplification of DO/TRY as much as structures for sequential tests that may or may not fail. REBOL doesn't have anything here, so you have to roll your own. Say you're trying to connect somewhere in a protocol and one of 50 things can go wrong, so you have to state 50 tests, 50 error messages, 50 exit routes. That's a lot of lines of almost identical code. |
Geomol 8-Mar-2010 [1477x3] | There may be another concern with this. How do we get the error in the except block, so we can handle it? A common way is: if error? result: try [1 / 0] [probe result] This doesn't work: (Remember to clear result, if you did the above first.) result: try/except [1 / 0] [probe result] And having /EXCEPT on DO is the same problem. |
Henrik, yes, what you explain is a common problem. The best way to handle it, as I see it, is with a foreach loop, like this: foreach [code handle-error] [ [do something] [handle-error-1] [do something-else] [handle-error-2] ... ] [ if error? err: try code handle-error ] | |
Ah, maybe handle-error-1, -2, ... shouldn't be in blocks. But you get the idea. | |
Henrik 8-Mar-2010 [1480] | that's possible, although you need to break at the error. at least that's how I would want it |
Geomol 8-Mar-2010 [1481] | Agree, gotta break out of the FOREACH loop too. |
older newer | first last |