World: r3wp
[!REBOL3-OLD1]
older newer | first last |
Maxim 3-Apr-2009 [12628x2] | my first R3 func .... valid?: func [spec][attempt [assert spec]] ; -) |
so I can assert within any/all blocks ;-) | |
BrianH 3-Apr-2009 [12630] | valid?: func [spec /type][attempt [apply :assert [:spec type]]] |
Maxim 3-Apr-2009 [12631] | yess apply that is a great addition to R3 8-D |
BrianH 3-Apr-2009 [12632] | Already backported to R2-Forward. |
Maxim 3-Apr-2009 [12633] | must be a bit slow though... is it? |
BrianH 3-Apr-2009 [12634x3] | R2-Forward is also in DevBase (and has *lots* of comments). |
The R2-Forward APPLY is not as fast as the native, but I've found it fast enough for wrapper functions in R2. | |
Plus it disables the special treatment of 'a and :a declared parameters. | |
Maxim 3-Apr-2009 [12637] | is that gone in R3? (set word arguments) |
BrianH 3-Apr-2009 [12638] | Nope, they just work better. |
Geomol 3-Apr-2009 [12639] | Don't forget to keep it simple! As simple as possible, but not simpler. |
PatrickP61 6-Apr-2009 [12640x2] | Is there a way in R3 to "capture" error messages when using ATTEMPT, or some other command. i.e. >> WRITE %missing/File.txt to-binary "test string" ** Access error: Cannot open: %missing/File.txt reason: -3 ** Where: WRITE ** Near: WRITE %missing/File.txt to-binary "test string" >> ATTEMPT [WRITE %missing/File.txt to-binary "test string"] == none Is there any way to get the error message from the ATTEMPT? |
Found it! >> probe disarm try [WRITE %missing/File.txt to-binary "test string" make object! [ code: 500 type: 'Access id: 'cannot-open arg1: %missing/File.txt arg2: -3 arg3: none near: [WRITE %missing/File.txt to-binary "test string"] where: [WRITE try] ] == make object! [ code: 500 type: 'Access id: 'cannot-open arg1: %missing/File.txt arg2: -3 arg3: none near: [WRITE %missing/File.txt to-binary "test string"] where: [WRITE try] ] | |
ICarii 6-Apr-2009 [12642] | in R3 is there a way to intercept the write event before the send occurs - and if not, is there a way to force a send before another write takes place in an Async queue? I'm getting an issue where multiple write events are being cached and sent all at once (about 10 write events per second). |
Graham 6-Apr-2009 [12643] | What I think most people do is this: if error? set/any 'err try [ ][ probe mold disarm err ] |
Izkata 6-Apr-2009 [12644] | Is there any advantage to using set/any over a set-word ? |
Gregg 6-Apr-2009 [12645] | I'm not sure what you mean. They're unrelated. |
Izkata 6-Apr-2009 [12646x2] | if error? err: try [ ][ print mold disarm err ] |
I've always used the second way, but almost everywhere else, I see others use set/any | |
Gregg 6-Apr-2009 [12648] | Ah, I see now *a* set-word!. :-\ Consider an unset! result: >> if error? err: try [()] [print mold disarm err] ** Script Error: err needs a value ** Near: if error? err: try [()] >> if error? set/any 'err try [()] [print mold disarm err] == none |
Izkata 6-Apr-2009 [12649] | Ohhkay, guess I've just never run across it. Thanks |
Anton 6-Apr-2009 [12650] | Is there any way in R3 to optimize code such as out: insert insert insert insert insert [] 'fill-pen color [text vectorial] 0x0 "hello" ? I think the appearance of n INSERTs is kind of ludicrous. People are doing this for performance reasons, so the usual way we would optimize the code (which produces an intermediate block), isn't an answer. I've forgotten if R3 has any way. (A quick look at APPLY and MAP doesn't seem to bear any fruit.) |
Steeve 6-Apr-2009 [12651x2] | it's not more fast than using a reduce or a compose. |
but it saves memory overheads, exspecially in big loops | |
Anton 6-Apr-2009 [12653x5] | ---> thus, does become a speed issue. |
It would be nice to be able to say: loop 5 [insert] [ ] v1 v2 v3 v4 v5 | |
so no intermediate block is generated. | |
Or have a method of reducing only the items in a block as they are being applied, without generating a new temporary block to hold them. | |
(This idea has been discussed before, somewhere...) | |
Anton 7-Apr-2009 [12658] | About the loop 5 example; I remember Carl saying that would break the rebol evaluation rules, or something like that. But could we get that functionality some other way? |
Steeve 7-Apr-2009 [12659x8] | i think a reduce that can not creates a new block is not interesting, because the same block can not be anymore reduced next. |
so, you can't use it in a loop | |
but an insert fonction which can reduce all the values from a a block before adding them, is quite interesting. | |
something like, | |
insert/reduce ['fill-pen color 'text 'vectorial offset message]] | |
it means get the value of the worlds before adding them | |
could be, insert/get or insert/load as well | |
so that no new blocks are created | |
Ammon 7-Apr-2009 [12667] | Steeve... REPEND =D |
shadwolf 7-Apr-2009 [12668] | compose ? hihihihi |
Steeve 7-Apr-2009 [12669] | yes ok for the name REPEND, but we need a native func with no reduce inside |
Anton 7-Apr-2009 [12670] | Yes, it would be great if REPEND worked that way. |
Ammon 7-Apr-2009 [12671] | Anton, is there a reason COMPOSE won't do what you need here? If the objective is to avoid creating a temporary block, compose does it. |
BrianH 7-Apr-2009 [12672x2] | Look here: http://curecode.org/rebol3/ticket.rsp?id=506 |
Right on topic with what you are saying, and my biggest personal reqest for R3. | |
Anton 7-Apr-2009 [12674x2] | Ammon, both COMPOSE and REDUCE generate a new block. |
BrianH, that's good that that ticket exists. Thanks for pointing it out. Hopefully that will be implemented someday soon. | |
BrianH 7-Apr-2009 [12676] | That's why it's "urgent" priority. |
Geomol 8-Apr-2009 [12677] | I'm seriously beginning to loose faith in R3. As I see it, there are still a lot of bugs on the lowest levels, and most development is going on far above that level. It's like a tall building, where new windows are put in on the 123 floor, while there are still many cracks in the basement. I guess, it'll take years at best, before we see a stable R3 on major platforms at the same time. |
older newer | first last |