REBOL3 - Rebol School (Rebol School [web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

2864GrahamBasically the data about the user Graham was set to a zero byte file when my site was hacked .. and vanilla looks at the user file when it displays a snip authored by that user. It was unable to load this data causing an error, and since I authored many of the snips, it caused most of the site to go down.2-Jan-10 2:32
2863Graham 2:30
2862GrahamAndreas helped me today to debug the vanilla issue that was causing a server error for most pages ...2-Jan-10 2:29
2861GrahamThe Rebol School site is now working again after 4 years of malfunctions.2-Jan-10 2:29
2860CharlesWThank guys.20-Oct-09 18:46
2859Henrikyou were first, because it took 3 minutes to swap into textmate. :-) have too many things running here.20-Oct-09 18:37
2858PekrI have it in my user.r, so I almost forgot about it ...20-Oct-09 18:33
2857Pekr:-) now I was first :-)20-Oct-09 18:33
2856Henrikuse Pekr's code20-Oct-09 18:32
2855HenrikThis is for the backslash:

net-utils/url-parser/user-char: union net-utils/url-parser/user-char make bitset! #"\"

20-Oct-09 18:32
2854Pekrnet-utils/url-parser/user-char: union net-utils/url-parser/user-char make bitset! #"@"20-Oct-09 18:32
2853Pekryou can use block specification, instead of URL scheme ... or fix url-chars ...20-Oct-09 18:32
2852Henrikfound it20-Oct-09 18:29
2851HenrikI think there is a fix for that, but I can't remember what it is.20-Oct-09 18:28
2850CharlesWI am trying to retrieve email from a godaddy account. Their server however uses a username with the @ sign. I am not sure but I think this is messing up the pop protocol.

The error I receive is:

connecting to: ** Access Error: Cannot connect to ** Where: open-proto

Notice that my pop statment has two @ signs in it but is needed to login to goDaddy's multi-tenent pop server.

foreach message read pop:// [ print message ]

Any Suggestions?

20-Oct-09 18:12
2849Maximwow a bug with experience :-)7-Aug-09 23:41
2848GrahamBTW, you can use the same trick for those pesky apis that want leading zeros for time

>> time: now/time - 5:00 == 6:29:02 >> next form 100:00 + time == "06:29:02"

7-Aug-09 23:29
2847GrahamIt's something I learned from Forth .. math is always faster than logic.7-Aug-09 23:25
2846GrahamI ran 10,000 iterations with 'form and found it was 5x faster :)7-Aug-09 23:24
2845GreggDoesn't measure that much faster here, and you have to add the FORM call as well. Still nice. :-)

If performance is important, you can do two things: 1) cache NOW, 2) cache the whole result once a day.

7-Aug-09 22:58
2844WuJianNIce7-Aug-09 4:05
2843AntonNice one.6-Aug-09 11:43
2842Grahamlast version is 5x faster6-Aug-09 11:30
2841Grahamnow/year * 100 + now/month * 100 + now/day == 20090806

guess have to benchmark to see which is fastest

6-Aug-09 11:26
2840Grahamand for that mailing list question ... on how to format yyyymmdd

rejoin [ now/year next form 100 + now/month next form 100 + now/day ] == "20090806"

6-Aug-09 11:23
2839Grahamnext form 10000 + now/month == "0008"6-Aug-09 11:19
2838AshleyHere's a QAD I use:

>> i: 1 == 1 >> join skip "0000" length? form i i == "0001"

6-Aug-09 10:51
2837WuJianThank you.5-Aug-09 15:17
2836SunandaSeveral people have written such a function. Here's one of them: 15:13
2835WuJianExcuse me. How can I get zero padded with numeric values? for example I want the numeric strings from "0001" to "9999"5-Aug-09 15:08
2834BrianH"As always, there's a refinement you don't think of" - that's the best thing to remember about REBOL :)15-Jul-09 21:19
2833ChristianEMOLD/ONLY, ha! As always, there's a refinement you don't think of ...15-Jul-09 21:16
2832PatrickP61That is even better!15-Jul-09 20:24
2831BrianH>> print mold/only [print "ok"] print "ok"15-Jul-09 20:23
2830PatrickP61Thank you ChristianE -- I found similar code in SOURCE SOURCE15-Jul-09 20:20
2829ChristianE>> print mold code-blk [print "ok"] >> print head remove back tail remove mold code-blk print "ok"15-Jul-09 20:19
2828PatrickP61Ahhh, you are right Graham, since SOURCE did print the correct string somehow! Will dig into it15-Jul-09 20:17
2827Grahamhave a look at source source15-Jul-09 20:15
2826PatrickP61>> source code-blk code-blk: [print "ok"] <-- My goal is to just get print "ok"

Another way to pose the question is How can I convert the entire contents of a block, including spaces, into a string?

15-Jul-09 20:14
2825Grahamsource code-blk15-Jul-09 20:08
2824PatrickP61Asking for help on a formatting problem

I have the following block that cotains some rebol code which I wish to print on the console and then execute the code: >> code-blk: [print "ok"] == [print "ok"] <-- assigned a code block just fine >> do code-blk == ok <-- looks good so far >> print code-blk == ok <-- Nope that isn't what I was looking for, but I understand why since it is like print the results of print "ok" >> print form code-blk == print ok <-- getting closer to what I desire, but the quotes are missing >> print mold form code-blk == "print ok" <-- not what I desired -- I want the original code block to be printed as print "ok" with the quotes

Any ideas on how to fix this?

15-Jul-09 19:55
2823Henrikno problem12-Jun-09 18:41
2822Jankothanks Henrik!12-Jun-09 18:40
2821Jankonow that I know and read the docs I get that this is written , but I haven't before12-Jun-09 18:37
2820Jankoyes, that is more clear way to put it12-Jun-09 18:37
2819HenrikI think it's more correctly to say, it binds the context in which the words happen to exist.12-Jun-09 18:35
2818Jankoso it binds all the words from the context of the word you give it to?12-Jun-09 18:31
2817Henrikyes, because they exist in the same context.12-Jun-09 18:29
2816Janko... I don't get this example: >> words: [a b c] >> fun: func [a b c][print bind words 'a] >> fun 1 2 3 1 2 3

You give it just 'a to bind but is seems to bind b and c too??

12-Jun-09 18:28
2815Jankohm.. it seems I was using the parameters reverse and bind is exactly for this :)12-Jun-09 18:12
2814JankoI have one question ... I have parse blocks stored in some external block: parsers: [ aaa [ ( variable + 1 ) to abc ] ] so I do select parsers 'aaaa to get that block .. and then I >>parse string get-parse-bock<<

The problem is that "variable" in that block is defined in the function where parse happens ... and it's undefined inside parse block in this case ... any ideas how to bind it to it's outer variable... I haven't used bind or use before but I thought I can do something like this with bind .. but I can't make it work and I also don't "get" the bind example in docs

12-Jun-09 18:10
2813RobertS.22-May-09 16:11
2812PeterWoodI asked on R3 chat and got this answer:

Re #3821: T won't make it to the final distribution - it's for the test phase. It's not even documented. I expect that the function will go away inn the code reorganization.

28-Apr-09 16:45
2811Steevedamnit, i'm discovered28-Apr-09 16:00
2810PatrickP61Yes28-Apr-09 16:00
2809Steevewho me ?28-Apr-09 15:59
2808PatrickP61Steve , you are joking!!!28-Apr-09 15:59
2807PatrickP61I am speculating that the author intended this as a quick way of testing a script, just as I happened to write the exact same code in my script.28-Apr-09 15:59
2806Steevei got this: >> t: make function! [[][print "Noooo, don't look at me"]28-Apr-09 15:59
2805PeterWoodIt's in A49 on both Mac OS x and Linux Libc.28-Apr-09 15:57
2804PeterWood>> source t t: make function! [[][do %test.r]]28-Apr-09 15:56
2803PatrickP61You don't have it?28-Apr-09 15:56
2802Steeveeh i don't have it, maybe it's a virus28-Apr-09 15:55
2801PatrickP61Thanks for confirming this. I was loosing my mind!28-Apr-09 15:54
2800PatrickP61You have it too. I confirmed it has been there since r3-a32.exe and thought it was somehow somthing I screwed up28-Apr-09 15:54
2799ChristianEIt's in there at least since r3-a33.exe, I have no access to previous versions.28-Apr-09 15:53
2798ChristianEConfirmed. It's just there in a49.28-Apr-09 15:51
2797PatrickP61The only thing I can think of it that this is code in r3-a49.exe, which doesn't seem possible, so to rule that out, can someone else verify that the letter T is empty on their version of r3-a49.exe28-Apr-09 15:50
2796PatrickP61I can't figure it out. I know that Rebol will try to run REBOL.r and USER.r, but both of them do not have this definition. Where else could this assignment be made from?28-Apr-09 15:45
2795PatrickP61Where did the r3-curr.exe get the "definition" of the T variable from?28-Apr-09 15:44
2794PatrickP61So here is the mystery. I had copied over the r3-a49.exe into the r3-curr.exe and ran it directly, Then I accidentally typed T at the prompt, what I got surprised me: >> t ** Access error: cannot open: %test.r reason: ** Where: read case load applier do t ** Near: read source case [ binary? :content [content] string...

** Note: use WHY? for more about this error

28-Apr-09 15:43
2793PatrickP61I need a little help to figure something out. I have been using R3 for some time and I have a small mystery I can't figure out. Some time ago, I created a script called REBOL.r3a which simply invoked the r3-curr.exe file (which is currently a copy of the r3-a49.exe that was just released). This script was simply defined a path for the T variable: t: does [do %test.r] my purpose was to simply type the letter T to invoke the test.r script as a quick way of running it while I had the test.r script open in an editor on a separate window.28-Apr-09 15:40
2792ChristianEVladimir, it's fairly easy to - instead of HTML - generate an XSL-FO directly from REBOL and use the open source FO-Processor FOP from the Apache group to generate PDFs. You don't have to delve into XSL-Transformations yet have the full power of exact control over the layout.26-Apr-09 9:21
2791VladimirWill try it out, thanks Doc! As you said, I'll also try to use pdf-maker.r ...26-Apr-09 7:13
2790HenrikVID to postscript provides easy layout and simple previews of postscript layouts and I've found that converting to bitmaps is not always fast enough for what I need.25-Apr-09 21:41
2789DockimbelWhy converting VID to postscript? Is converting a View window to image for printing not enough? Do you have some special needs or requirements?25-Apr-09 21:25
2788Henrikok25-Apr-09 21:23
2787DockimbelAs I said, "my dialect" is a Draw subset, so if you can convert View faces to Draw dialect, you could print VID windows.25-Apr-09 21:21
2786HenrikI see.25-Apr-09 21:20
2785DockimbelBtw, it's not a Windows only driver, it works equally well on all OS using the CUPS printing system (like Linux, OS X, ...)25-Apr-09 21:20
2784HenrikDo you think it would be possible to translate a VID layout to your dialect? I have a method for that for direct postscript generation using Geomol's postscript dialect. This could be useful for a unified printing system, as I'm building a printing front end for my own apps.25-Apr-09 21:19
2783DockimbelThe PDF example in the archive is generated by using a free virtual PDF printer like Bullzip's one ( 21:19
2782Henrikok25-Apr-09 21:18
2781DockimbelYes, a subset of Draw dialect25-Apr-09 21:17
2780HenrikDoc, are you using DRAW to generate the output?25-Apr-09 21:17
2779DockimbelThis driver is best suited for direct printing, i.e., when you don't need to generate a document. Invoices are document that need to be saved and transmitted, so I would recommend generating PDF files in such case.25-Apr-09 21:16
2778DockimbelYou can find it here : 21:10
2777VladimirWhere can it be found?25-Apr-09 20:23
2776GrahamUse dockimbel's windows printer driver25-Apr-09 20:21
2775Vladimir1. What method would you recomend for printing invoices ? I promised my sister, I will make small aplication for invoices till the end of this week :) I guess best way would be making HTML or PDF file and then leting systm deal with actual printing ? Or making a face looking just like the needed document (like print preview) and then printing that picture ?

2. Is there a way to scale face ? like zoom in and out ?

25-Apr-09 20:16
2774AntonBasically one executable, some linker files, some include files. The include files are where the feature creep starts.. How many standard C header files do I include?21-Apr-09 14:30
2773PekrAnton - what form is TCC in? Few dlls? Executable? You could probably create "new REBOL" using SDK - simply bundle it into new exe with all stuff you need (IIRC SDK allows loading internal binary stuff). Or pack it into one file, give it plugin suffix :-) Then normally read and decompress it, then load it :-)21-Apr-09 14:25
2772AntonIf you tried DO-THRU above, then it should be the most recent file in your public cache. But anyway, here is a direct link. 14:20
2771SteeveHmm, Anton, i can't figure where is your source of draw-tunnel.c Can you give a direct link, please ?21-Apr-09 14:02
2770Anton(I didn't figure out how to bundle TCC standalone yet.. just a few experiments, so that's why you need to install TCC to the system.)21-Apr-09 13:19
2769Anton(Actually, you need to read this file first, and follow Usage instructions to install TCC first. Then you can do-thru as above..)21-Apr-09 13:19
2768AntonSteeve, try this: do-thru 13:17
2767JankoBrianH, yes interesting question... ocaml is closing in to c if you want FP, Java speed-wise also but has a bigger ram usage and startup times I guess. but it's also hard to say "what is the high level" that we want. Is it Java like, is it dynamic langs, is it FP20-Apr-09 18:52
2766SteeveAny chance to see your current work or how you configurate TCC for Rebol , Anton ?20-Apr-09 17:50
2765BrianHI'm interested to see who gets there first: The languages that try to graft safety and high-level features onto C (Cyclone, Vala, ...) or the efforts to speed up languages that already have the safety and high-level features.20-Apr-09 17:19
2764BrianHThere are several "safe C" languages out there. Cyclone looks interesting, but hasn't been updated since 2006.20-Apr-09 17:16
2763JankoI got to Cyclone from the tcc website.. does anyone have an oppinion on this ? it seems interesting to me20-Apr-09 16:43
2762BrianHThe plugin model should be compatible with a wide variety of licenses, so there may be better candidates for this kind of thing. Most of the other languages in REBOL's class are working on LLVM, CIL and JVM backends, but those are all pretty large. Perhaps libjit now that it is LGPL - that would be a plugin-compatible license, I expect.20-Apr-09 16:23
2761AntonAfter that, I suppose it could grow into a plugin.20-Apr-09 15:44
2760AntonWell, the TCC binary here is 129ko. I don't think Carl will be adding it to the Rebol executable, anyway. The trick, I think, is to have a simple set of instructions to install TCC ready to use with Rebol.20-Apr-09 15:42
2759PekrI wonder what would be the option? REBOL would found out there is a "rebcode" in it, it would be a C code, and then your app would have to compile and link it in order for being able to execute it? Could there be a precompiled (or compile at first run) option? Because if not, then it would be slow, no?20-Apr-09 15:30
2758PekrI doubt that, unless it is available to all the platforms. Also - Anton - how "big" it is in terms of KBs it would add to REBOL executable? Is it under 100KB? :-) Because if not, Carl might not consider it :-) But who knows, R3 is going to have plug-ins, so it might be as kind of external "rebcode" engine. The first thing I woudl probably do is I would consider ASM/JIT, Blit/JIT addition (not sure it is cross-plaform either though)20-Apr-09 15:28
2757amacleodIs that the answer to rebcode in R3?20-Apr-09 14:56
2756SteeveNice anton, I hope we'll see your work soon...20-Apr-09 13:45
2755AntonOn 19-Feb-2009 in this group I said that Tiny C Compiler (TCC) had problems. Well, I tried again using the latest version from git repository and successfully created a shared object library which can be accessed by Rebol. So, Vladimir's tunel.r code, which I ported to C, can now be compiled using TCC (as well as GCC). This is good because TCC is much smaller (and faster) than GCC and can hopefully be integrated in nice, small cross-platform packages.20-Apr-09 10:16
2754Jankosqlab .. you are a real object magician :) ... not sure either if this can help me right now but good to know for this16-Apr-09 15:43
2753TomBonIt is not 'everytime' wise to look for the smallest possible. funcionality is the key here in my opinion.16-Apr-09 15:14
2752sqlabI am not sure if this can help, but you can get objects with references instead of copies, when you modify them after creation. maybe like this >> template: make object! [ [ a: 1 [ b: 3 [ c: "times" [ ] >> >> obj1: make template [ [ a: 2 [ b: 4 [ c: none [ f: does [print [ a c b "gives" a * b] ] [ ] >> >> obj1/c: template/c == "times" >> >> obj1/f 2 times 4 gives 8

here c is just a reference, not a copy >>

16-Apr-09 15:12
2751TomBonfor this small overhead you buy objects which are much better and flexible.16-Apr-09 15:11
2750Jankoif we would need really lighweight actors they would have to be made with blocks so that they would hold just data , .. rebol creates 1.000.000 blocks with key and empty string in 4 sec and 70MB, but it is question if this is really needed, with objects you can very nicely as normal objects extend them into new types of actors16-Apr-09 14:34
2749Jankothanks Tom, I hope something ok will come out of it :)16-Apr-09 14:19
2748TomBoninteresting project janko, will follow your updates.16-Apr-09 14:17
2747JankoI will post new version with some updates in few days, it will have some similar pattern matching/deconstruction for messages, remote actor spawning too, actors could remove themselves, and hopefully some solution for addressing actors more elegantly by then16-Apr-09 14:08
2746Jankono no,... upthere I was trying to make actors lighter... each actor is a object now , and each carries around code in it's methods so it's not as lightweight as it could be.. but this is more of a theoretical probem for now.. as I said I am more interested in them for distributted programming so I maybe won't be spawning and having 100 000 actors around like in erlang for ecample16-Apr-09 14:02
2745sqlabDo I understand that you want to send actors a message and they should act upon the elements of an objects of the sending process?16-Apr-09 13:59
2744JankoTomBon ... yes , erlangs actors are the inspiration for this, although I don't have plan to mimic them entirelly .. actors/processes there are main building blocks of app in erlang, you can have many thousands of them , spawn them all the time etc.. here so far my goal is more to use them for distributted computing part, communication between various processes/computers ( I have servers that need to talk to bots etc.. and back)16-Apr-09 13:58
2743TomBonhi janko, have you seen the erlang concept of concurrent distributed programming? perhaps you can find there some additional ideas. A robust and complete p2p component in rebol would be fantastic.16-Apr-09 13:52
2742JankoI need to see more how this is used before I start optimising, I thought I can make some optimisation without complicating it all up and make it less elegant to use and extend16-Apr-09 13:43
2741Jankohot = got16-Apr-09 13:41
2740Janko(again , it hot distorted) ... I am thinking that I won't change it all and make usage more ugly becase right now I don't even know If I will ever need to have 100000 actors running.. so for now I will continue using object and try to make it elegant without worying about this16-Apr-09 13:40
2739Janko ... I am thinking that I won't change it all and make usage more ugly becase right now I don't even know If I will ever need to have 100000 actors running.. so for now I will continue using object and try to make it elegant without worying about this16-Apr-09 13:39
2738sqlabUnfortunately i do not understand, what you do with your actors.16-Apr-09 13:35
2737Jankoah, I am stupid is actor-static is just one for 100 copires than parent can't only point to one parent so this won't work16-Apr-09 13:25
2736Jankoaha, this works, thanks to your ideas.

actor-static!: make object! [ parent: none act-match: copy [] act: [ match-do take parent/mbox act-match ] test: [ print parent/mbox ] mode: 'm ]

actor: make object! [ S: self mbox: copy [] vars: copy [] static: make actor-static! [ parent: S ] ]

16-Apr-09 13:17
2735Jankoso they can be used like this... this is how it currently worked (without static) ...

cat-boss: make actor [ act-match: [ [ still-seeking ] [ print "cat boss: our cat agent is still seeking!!" ] [ found-fish ] [ print "cat boss: yeey, we found a fish!!" ] ] ]

... anyway, thanks for your help so far a lot! I need to start my brain, it seems it doesn't work very well today

16-Apr-09 13:13
2734Jankohm.. but act are blocks of code .. not functions right now so they don't have params16-Apr-09 13:09
2733JankoI tried this.. but self in that context is the subobject ...

actor-static!: make object! [ parent: none act-match: copy [] act: [ match-do take mbox act-match ] test: [ print parent/mbox ] mode: 'm ]

actor: make object! [ mbox: copy [] vars: copy [] static: make actor-static! [ parent: self ] ]

16-Apr-09 13:08
2732sqlabYou have to give the parent object as a parameter to the functions in the sub objects, then you can acces the elements as pobj/name16-Apr-09 13:07
2731Jankosqlab: hm.. but do you know for a way that subobject could access parent's objects data?16-Apr-09 13:03
2730JankoI also tried this but it works the same as if I define block in object

A-a: [ print "something" a: 2 + 3 + 5 loop 10 [ print "a" ] ] A: make object! [ a: does A-a ] AS: copy [] loop 100000 [ append AS make A [ ] ]

16-Apr-09 12:42
2729Jankosqlab - bravo! your trick works..

A: make object! [ proto: make object! [ a: does [ print "something" a: 2 + 3 + 5 loop 10 [ print "a" ] ] ] ] AS: copy [] loop 100000 [ append AS make A [ ] ]

went to 21MB ram ---

I have to see what this means to inheritance and other things

16-Apr-09 12:41
2728Janko( It is understandable why is this , block (like parse block or block of code) , and also func in rebol body is just "data" and you can change it in each instance ) ..16-Apr-09 12:25
2727Jankosqlab - I will try what you say.. I asked because at the actor lib I am making each actor/thread is one object so I want to have them as lightweight as possible16-Apr-09 12:23
2726JankoI was away... I tested on these 3 cases... started new rebol each time, it took 13MB of ram at start

A: make object! [ a: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" b: [ 123 1231 13 123 12313 1 2312 3123 123123 12 231 21 312 12 123 31231231 2312 312 1231 2123 123 12 3123 12 312 312 312 312 31 23 123 123 12 312 31 23 123 12 312 312 3 123 12 312 31 23 123 12 312 3 123 12 31 3 123 13 12 123 123 12 3 123 1231 23 123 123 12 312 3 123 12 312 3 123 12 312 3 123 12 31 23 123 12 31 23 123 1 23 123 12 31 2 23 12 3 1 3 12 312 3 123 12 3 ] ] AS: copy [] loop 100000 [ append AS make A [ ] ]

went to 250MB RAM --

A: make object! [ a: does [ print "something" a: 2 + 3 + 5 loop 10 [ print "a" ] ] ] AS: copy [] loop 100000 [ append AS make A [ ] ]

went to 50MB of ram --

A: make object! [ a: "" ] AS: copy [] loop 100000 [ append AS make A [ ] ]

went to 25MB of ram --

16-Apr-09 12:21
2725sqlabYou can use this method, if you don't want to get copies A: make object! [ add: func [ ] [ .... ] sub: make object! [parse-rule: [ ..... ] ]] then the elements in the subobject are just references.16-Apr-09 11:14
2724PeterWoodI believe you are correct. There is no separate "prototype" in Rebol.16-Apr-09 10:45
2723Jankoit seems it makes copies16-Apr-09 9:57
2722Jankoif I have rebol object R2 >>

A: make object [ add: func [ ] [ .... ] remove: func [ ] [ ....... ] parse-rule: [ ..... ] ] B: make A [ change: func [ ] [ .... ] ]

<< and if I make 100 objects like B from A ... does this mean each of them has it's own "add remove parse-rules" copy in memory or there is just one copy of these functions/blocks that they share it?

16-Apr-09 9:45
2721sqlabWrap your tests in a block, then you can do at least in R2 until [ either error? set/any 'err try [ t: do/next tests ] [ print disarm err tests: next tests ] [ tests: second t ] empty? tests ] Unfortunately it does not work with R3. .( There you have to wrap every statement in a block inside the main block. Then you can do them one by one.8-Apr-09 12:35
2720PatrickP61Thanks Oldes, I'll play with it!8-Apr-09 2:39
2719Oldes*append = attempt7-Apr-09 21:09
2718OldesAnyway, I use modified append to be able see if there is an error somewhere (where is unexpected) without stoping the execution. If I know, that somewhere can be an error, then I use just simple error? try []7-Apr-09 21:09
2717OldesNow when I see the code (which is probably not mine), the handling of args is not correct as any missing arg will now set all of them as "(missing value)". But at least you can have an idea, how to work with the disarmed error!7-Apr-09 21:04
2716OldesI'm ussing: attempt: func [value][ either error? set/any 'value try :value [ print parse-error disarm value none ] [get/any 'value] ] parse-error: func [ error [object!] /local type id arg1 arg2 arg3 wh ][ type: error/type id: error/id wh: mold get/any in error 'where either any [ unset? get/any in error 'arg1 unset? get/any in error 'arg2 unset? get/any in error 'arg3 ] [ arg1: arg2: arg3: "(missing value)" ] [ arg1: error/arg1 arg2: error/arg2 arg3: error/arg3 ] rejoin ["** " system/error/:type/type ": " reduce either block? system/error/:type/:id [ bind to-block system/error/:type/:id 'arg1 ] [ form system/error/:type/:id ] newline reform ["** Where: " wh newline "** Near: " mold error/near newline] ] ]7-Apr-09 20:52
2715Oldesof course.. just do: probe disarm err7-Apr-09 20:51
2714PatrickP61If only there was a way to "capture" the specific error message at the time of disarm err, and print those results Could that be done?7-Apr-09 20:11
2713PatrickP61oops, wrong cut and paste -- here is the revised results:

Results below generated from %VT-Script.r unset [x] print x ** error

print x ** error

See results stored in %VT-Results.txt file

7-Apr-09 20:11
2712PatrickP61Henrik, Your suggestion did achomplish the task of trapping an error when it happened so it is better than nothing -- see resutls:

Rebol [] echo %VT-Results.txt print {Results below generated from %VT-Script.r} print {unset [x]} unset [x] print {print x} set/any 'err try [print x] if error? err [ disarm err print "** error"] print "" print {print x} set/any 'err try [print x] if error? err [ disarm err print "** error"] print "" print {See results stored in %VT-Results.txt file} echo off halt

will generate:

Results below generated from %VT-Script.r unset [x] print x print x See results stored in %VT-Results.txt file

7-Apr-09 20:09
2711PatrickP61So, I want to capture the error message as it would appear -- even though I know it will stop the script. I just hoped there was a way of having R3 print the error message as it normally would, but then have R3 continue to run the script instead of stopping it.

For example, if I knew that R3 was using the HALT command, then I could temprarily redefine the HALT command to an empty block and R3 should continue to run, but I am just spouting this off the top of my head -- I don't know how R3 "stops" the script.

7-Apr-09 19:42
2710PatrickP61Yes, you are correct, The purpose of THIS script is to test and verify the R3 documents and see if the results printed on the website is the same as the results you get (for r3alpha)7-Apr-09 19:38
2709Henrikbut... it all depends on what the ultimate goal of trapping the errors is. if the code was written properly, you'd do this:

unset [x] unless value? 'x [ print "X has no value" ]

7-Apr-09 19:37
2708PatrickP61giving it a try!7-Apr-09 19:36
2707Henrikand you may continue after that if err is not an error.7-Apr-09 19:35
2706Henrikunset [x] set/any 'err try [print x] if error? err [ probe disarm err ]7-Apr-09 19:35
2705PatrickP61But, if the command succeeds without error, I want to get the results of that as well7-Apr-09 19:34
2704PatrickP61so how would I change the PRINT X in such a way to capture an error withotu stopping the script?7-Apr-09 19:33
2703PatrickP61x is undefined and has no value7-Apr-09 19:32
2702PatrickP61OK, lets take a simple example that I know errors out UNSET [x] print x7-Apr-09 19:32
2701PatrickP61trying to understand -- :-/ (still a newbie!!!)7-Apr-09 19:31
2700Henrikthat's the only way. the only way to simply keep going is to wrap small bits of code in TRY and that's not good style.7-Apr-09 19:31
2699Henrikor more useful:

if error? err [probe disarm err]

7-Apr-09 19:30
2698Henrik'err in that example means you have evaluated a block and the result is returned to 'err. you can then test if 'err contains a good result or an error like so:

if error? err [ print "oops" ]

7-Apr-09 19:29
2697PatrickP61Or are you saying that another function such as TRY will "insulate" the error from causing my script to stop running?7-Apr-09 19:29
2696PatrickP61Yes, but there must be ways to trap an error without stopping the script.7-Apr-09 19:29
2695Henrikif you want to generally test the entire script, the only way is to wrap it in a TRY or the elements you run in a TRY. REBOL will stop evaluating a block if it encounters an error in it.7-Apr-09 19:28
2694PatrickP61I've been reading up a little on generating errors at one line in particular captured my attention:

The error message generated for my-error can be printed without stopping the script:

disarmed: disarm err print bind (get disarmed/id) (in disarmed 'id) this doesn't go into that using my-function

-- Not sure if this has any legs for me?

7-Apr-09 19:28
2693Henriksorry, I thought you had a result to test.7-Apr-09 19:27
2692PatrickP61I added that at the head of my VT-SCRIPT, but it didn't work

** Script error: error has no value

7-Apr-09 19:25
2691Henrikit should be enough to:

probe disarm error

7-Apr-09 19:23
2690PatrickP61Hi Henrik It is just fine that the console error messages print whatever they print, but I want some way of having my script continue depsite the error message encountered. Is there a way to have REBOL invoke a separate independent console that it could do its own commands in. Then, I could simply submit one rebol command per session, and capture the results in the ECHO file regardless of wheter the command errored out or not.

Could that work?

7-Apr-09 19:11
2689HenrikI think you can't, unless you settle for printing the error object. That's possible. The console error messages themselves can't be reached, I think.7-Apr-09 18:51
2688PatrickP61How does ERROR work? What does the kernal actually do when it encounters an error? I see that errors condition can be trapped with commands such as TRY, DISARM, ATTEMPT, but is there a way I can capture the printed results of an error without the error causing my script to stop running?7-Apr-09 18:44
2687PatrickP61Does anyone know of a way to have a rebol script continue to execute even after it recieves an error?

I have a script VERSION-TESTER, that will gather code examples and create another script VT-SCRIPT that will test them all out against the newest version of R3 alpha.

VT-SCRIPT is extremely simple, capturing all console results into an ECHO file, but I need a way to have the script continue even when it finds an error. Any ideas? See this simple example:

Rebol [script: %VT-Script.r will verify R3 documented examples] echo %VT-Results.txt print {Results below generated from %VT-Script.r} print {---------------------------------------TIME examples } print {var: now } var: now print {print var } print var print {7-Apr-2009/11:53:26-6:00 <-- same? } print {} print {---------------------------------------WRITE examples } print {write %junkme.txt "This is a junk file." } write %junkme.txt "This is a junk file." print {print read %junkme.txt } print read %junkme.txt print {This is a junk file. <-- same? } print {} print {write/binary %data compress "this is compressed data" } write/binary %data compress "this is compressed data" print {print decompress read %data } print {this is compressed data <-- same? } print {} print {---------------------------------------PROTECT examples } print {test: "text" } test: "text" print {protect test } protect test print {append test "a" } print {** Script error: protected value or series - cannot modify } print {** Where: append } print {** Near: append test "a" } print {} print {** Note: use WHY? for more about this error } print {} print {----------------------------------------OTHER examples } print {unset [var] } unset [var] print {print var } print var print {** Script error: var has no value <-- same? } print {} print {** Note: use WHY? for more about this error } print {} print {---------------------------------------TEST COMPLETED }

print {See results stored in %VT-Results.txt file} echo off

7-Apr-09 18:17
2686GrahamWhat I initially did was only create the GUI on completion of the call which was fine when testing on the LAN, but as soon as you got internet latencies ... it was not so good.28-Mar-09 3:18
2685GrahamWhat I have found working with asynchronous functions that return data from database calls ... one should create some type of gui at the start of the call, and then replace that in the callback.28-Mar-09 3:17
2684VladimirIts working :) I guess this is cool.... Made a function in a separate file that calculates sum. But with a press on a button, I rewrote part of that file with function that multiplies two numbers instead of adding... And from that point on its multiply that you get... It has a lot of potential but have to find good use for it.... :) Thanks guys, Im of to sleep, its been a long day.....27-Mar-09 23:14
2683Vladimir:) I already started writing self modifying code :) at least I think thats what it is... :)27-Mar-09 22:53
2682HenrikI guess this is one of the freedoms you have, when no IDE is bogging you down or telling you how to do things. :-)27-Mar-09 22:52
2681VladimirSo what I got from this small discussion (in no particullar order):: 1. Create gui, create data, add supporting code... 2. Create rebol code with rebol... 3. Create a dialect or two (or more :)) specific to the task... 4. Create small code files and put them together using preprocessor... 5. Figure out a "reasonable" way to do it :)27-Mar-09 22:49
2680Henrikactually, I added some doc descriptions to the dialect, so I could have autogenerated docs from the dialect too.27-Mar-09 22:41
2679Henrikyes, like state tables. I use that too. :-)27-Mar-09 22:39
2678Vladimirgot it.... :)27-Mar-09 22:39
2677Henrikwhen you know enough REBOL, you can flip a problem in any angle to your advantage. here it was advantageous to keep two separate parts strictly in sync.27-Mar-09 22:39
2676VladimirWell, I used rebol to make lookup table data for my asm code :) I guess its something like that? making code from data ? sort of....27-Mar-09 22:39
2675VladimirThat was ment just as example of how one small thing can make life much easier.....27-Mar-09 22:38
2674HenrikVladimir, it's a poor explanation, so don't get a headache. :-) Basically REBOL allowed me to create a dialect that would flesh out a database protocol in one single 10k script and then use that dialect to separate bits and pieces out in a server and client part. That way, I didn't have to manually write a server script and a client script in two separate parts.27-Mar-09 22:37
2673Grahamthough my app was started prior to that functionality27-Mar-09 22:36
2672GrahamRebGUI already has support for forms27-Mar-09 22:36
2671HenrikBy generating code, I mean generating scripts, dialects or things that don't make sense or is too heavy to create in runtime.27-Mar-09 22:34
2670GrahamI created the screens first .. then built the data structures and then the supporting code after that.27-Mar-09 22:34
2669VladimirI'll need a minute to understand what you wrote :)27-Mar-09 22:34
2668VladimirHenrik: What did you mean by generating code? When I started writing applications that requiered data entry, I always first wrote an object that takes text as input (something like this: "'Name' c20 'Address' c30 'Town' c30) and displays modal dialog with those fields, OK and Cancel buttons, and all the logic that is needed... So all my data entry dialogs looked and worked the same and all that usually fit in one screen of code....27-Mar-09 22:33
2667HenrikI once built a db protocol using a dialect, which would generate the server side code and the client side code. Both sides were dialects too. This was wrapped inside another dialect which could build the server and multiple client programs by preprocessing and putting together multiple other scripts. Works pretty well and it takes about 5 minutes to add a new command to the protocol and update server and client.27-Mar-09 22:32
2666ChrisNo reason why not.27-Mar-09 22:31
2665VladimirI had an idea.... :) bare with me.... is it possible to start a script that would while running, change itself (file on disk), and than transfer control to this new version of itself ?27-Mar-09 22:27
2664Vladimiraha.... thats more like it :)27-Mar-09 22:26
2663Henrikactually there might be: generate REBOL code with REBOL.27-Mar-09 22:25
2662VladimirSo no magic rebol wand to make it better than the rest ? :)27-Mar-09 22:25
2661ChrisV: similar with dialects...27-Mar-09 22:25
2660Vladimir:)27-Mar-09 22:25
2659HenrikI don't think there is a particularly REBOLish way to write large programs. You just figure out a reasonable way to do it.27-Mar-09 22:24
2658VladimirDesigning gui in rebol is quite simple, with rebgui even more.... So one aproach would be: 1. Make interface look like it shoud be 2. attach code to be executed on events27-Mar-09 22:24
2657HenrikWell, I tend to write a lot of small code files and string them together with a preprocessor.27-Mar-09 22:24
2656VladimirI used asm, basic, pascal, c, database, clipper, foxpro.......... I kinda know how to use those in an efficient manner.... What about rebol?27-Mar-09 22:23
2655ChrisIt's similar I suppose to prototyping with a GUI, designing the front-end first and building the application to drive it. I prefer working that way...27-Mar-09 22:22
2654VladimirOr, how to make writing apps simpler ?27-Mar-09 22:21
2653VladimirYes.... for example I used Visual Fox pro a lot... and its great for stuff like that... It has Separate concepts like Database, Data entry forms, Print reports etc....27-Mar-09 22:21
2652SunandaA dialect is a good way of structuring a user interface. I think your question is more related to the underlying structure of the code that implements the whole application -- not just the dialect.. Does that sound about right?27-Mar-09 22:18
2651Vladimirok... :) thats what I ment... So should one start from bottom, from basics? Like in in accounting "calculate tax for one item" and then make functions for all more complicated stuff ? something like that?27-Mar-09 22:18
2650Chris'Dialect' is a good term for what a dialect is, but 'Domain Specific Language' is perhaps a better indicator of the problems dialects solve.27-Mar-09 22:15
2649VladimirI guess this is the best place to ask this question:

I wrote many scripts in rebol that helped me a lot but they were all just that... small scripts (I think biggest of them all was 40-50 lines...). My question is, what would be "Rebol way" of writing more complicated applications in rebol ? Stuff like game or accounting application, something with many parts.... What would be differences from other languages? And why would it be better? :) What about dialects? Should rebol programmer start with making a specific dialect first?

27-Mar-09 22:08
2648PatrickP61I guess I can answer my own question! :-)12-Mar-09 20:04
2647PatrickP61Please disregard my post. I missed the fact that the upper case i handles this.12-Mar-09 20:03
2646PatrickP61I will ask Christopher for his assistance, I think this may not be the right forum to answer this question.12-Mar-09 19:46
2645PatrickP61I see a small error in my conditions, it should read time/hour < 12 instead of > 1212-Mar-09 19:43
2644PatrickP61I'm playing around with FORM-DATE.R from the site and I'm having trouble with a couple of commands I am trying to define a new date-code of lowercase h to return the hour in regular time, not military time such that 13-24 would be 1-12. ie #"h" [PICK [ time/hour ( time/hour - 12 ) ] time/hour > 12 ] <-- pick the value of time/hour to be between 1-12 but when I try an example such as: am: does [form-date 2009-01-02/03:04:05 "%y%m%d %h:%M%P"] <-- I get "090102 time/hour - 12:04AM" hours is realy 03 pm: does [form-date 2009-11-12/13:14:15 "%y%m%d %h:%M%P"] <-- I get "091112 time/hour:14PM" how do I get r3 to evaluate the time/hour - 12 or the time/hour value before it picks the results?12-Mar-09 19:41
2643PatrickP61good to know10-Mar-09 19:04
2642Steeveor (list-dir)10-Mar-09 19:04
2641Steeveor list-dir %.10-Mar-09 19:03
2640DockimbelIf you use LIST-DIR in a script, you should provide the directory argument or enclose it with brackets like : do [list-dir]10-Mar-09 19:03
2639PatrickP61Thank Steeve and Dockimbel, I think I can play with it a little more10-Mar-09 19:03
2638Steeveit's because list-dir needs an argument not furnished in my example10-Mar-09 19:02
2637PatrickP61Dockimbel, I'll give it a try10-Mar-09 19:00
2636PatrickP61tried it out, but no luck, R3 is giving Script error: list-dir does not allow set-word! for it's 'path argument I think I have to dig into the LIST-DIR a little more to see how it works I had hoped there would be an easier way to take the results of a PRINT and be able to load it into a block instead of putting to the console.10-Mar-09 19:00
2635DockimbelYou can also use this script :

do capture on list-dir capture off probe get-captured

10-Mar-09 18:58
2634Steeveright10-Mar-09 18:57
2633PatrickP61ahhh, so you temporarily capture the source of PRINT into P then clear a block called OUT then change the print to append results to it, then LIST-DIR will invoke the PRINT command to the new function and reset PRINT back to original defintion.10-Mar-09 18:56
2632Steevehmm... something like that

p: :print out: [] print: func [v][append out reform v] list-dir print: :p probe out

10-Mar-09 18:51
2631PatrickP61Can you give example such as getting the results of LIST-DIR/L?10-Mar-09 18:49
2630Steevejust overide print functions during a short time10-Mar-09 18:48
2629PatrickP61or File-Details-blk: LIST-DIR/L10-Mar-09 18:44
2628PatrickP61Question to all How can I get the results of a PRINT to load into a block? ie File-list-blk: LIST-DIR10-Mar-09 18:41
2627kib2How's responsible of Rebol wiki contents ? The docs on R3 GUI (written by Kr bacon) are really pleasant to read.8-Mar-09 12:48
2626kib2BrianH: this seems a right approach to me, it makes sense.8-Mar-09 12:45
2625BrianHHaving only a single level of operator precedence was done to make it faster to program in REBOL. It makes it easier to remember the precedence rules when reading or writing REBOL, something that anyone with experience in most programming languages can tell you is tricky at times. Having fewer language rules to remember makes the language less distracting from the programming process. Though it is also faster to run, as it makes DO simpler (and even moreso in R3).7-Mar-09 18:37
2624kib2Geomol: sorry for the delay, it was lunch time for me. It's the first langage where i see no operator priority (maybe with Lisp, but it's because of its notation). Thanks, and that may explain why I wasn't able to draw something correctly in a GUI app.7-Mar-09 11:48
2623GeomolList of operators: >> ? op!7-Mar-09 11:15
2622GeomolAnd operators can also be prefix, which looks kinda weird:

>> + 4 5 == 9 >> random + 4 5 == 2

7-Mar-09 11:14
2621GeomolAnd note, that things like = is also an operator.

>> if 3 = 1 + 2 [print 'ok] ** Script Error: Expected one of: logic! - not: integer! >> if 1 + 2 = 3 [print 'ok] ok

7-Mar-09 11:09
2620GeomolAlso note, that infix operators (like + - * / etc.) are evaluated before prefix functions. So

random 4 + 5

is the same as

random (4 + 5)

7-Mar-09 11:07
2619GeomolRebol evaluate from left to right. There is no operator priority. It's because of performance, I guess.7-Mar-09 11:05
2618kib2Hi. Here's my code : I don't understand REBOL's behaviour here at the second step of the output. I also saw that putting parenthesis like this: s: s + (v/1 * v/2) gave the right answer, but i wanted to know why operators priority were not applied correctly.7-Mar-09 10:59
2617PatrickP61Yes that worked, I was able to the following: change-dir FILE-DIR Thank you6-Mar-09 16:58
2616PatrickP61I'll try it6-Mar-09 16:52
2615kib2Maybe just : first split-path %/C/Documents%20and%20Settings/Owner/filename.txt ?6-Mar-09 16:50
2614PatrickP61All I really need to do is truncate everything after the last "/" .. is that right?6-Mar-09 16:36
2613PatrickP61Quest to all: What is the easiest / best way to convert a file path to a dir path? Example FILE-PATH: request-file ; assigns a specific file path == %/C/Documents%20and%20Settings/Owner/filename.txt How can I assign a variable like FILE-DIR: to become the directory of FILE-PATH i.e. %/C/Documents%20and%20Settings/Owner/ Ideas?6-Mar-09 16:33
2612kib2Right, thanks.5-Mar-09 16:18
2611GeomolSee: 16:09
2610Geomole/x -> e/offset/x5-Mar-09 16:07
2609kib2funny, if I change 'over to 'down I have something on screen. But I just can't understand why I then got an error about Invalid path value: x Near: x: round/down e/x / 405-Mar-09 16:07
2608Geomolrepend out ['return] is overkill. Just write: append out [return] (notice without ' ) or append out 'return5-Mar-09 16:06
2607kib2hum...the problem is actualy to know where !5-Mar-09 16:01
2606GeomolYou have a simple bug somewhere, I guess. :-)5-Mar-09 15:59
2605GeomolThis works here:

myl: [style node image logo.gif effect [draw [line]] feel [engage: func [f a e] [if a = 'over [append f/effect/draw e/offset show f]]]] append myl [node "my node"] view layout myl

5-Mar-09 15:59
2604kib2Yes, like this : view center-face layout monlayout5-Mar-09 15:53
2603GeomolDo you layout monlayout after this?5-Mar-09 15:53
2602kib2that changes nothing. My buutons are appened at runtime like this :

out: copy [] foreach line hashi [ foreach letter line [ either (letter = "") [repend out ['p letter] ] [repend out ['node letter]] ] repend out ['return] ]

then ... monlayout def

then ... append monlayout out

5-Mar-09 15:26
2601Geomol*monlayout*5-Mar-09 15:23
2600GeomolPut extra p and node at the bottom of your momlayout.5-Mar-09 15:23
2599Geomolyes, but it's just a definition. Where is your buttons? :-)5-Mar-09 15:22
2598kib2it isn't attached to the node style ?5-Mar-09 15:21
2597GeomolThe effect isn't attached to a style. You have style definitions, and then effect.5-Mar-09 15:20
2596kib2that does not work...even the print message does not appear. An idea ?

monlayout: [ origin 0x0 space 0x0 across ; --- define a new button (style) style p image %vide.png style node image %but.png effect [draw [line]] feel [ engage: func [f a e /local x y island] [ if a = 'over [ print "over" x: round/down e/x / 40 + 1 y: round/down e/y / 40 + 1 island: game/:x/:y if island/ways <> none [ foreach v island/ways [ append f/effect/draw to-pair [x y] to-pair [v/x v/y] show f ] ] ] ] ] ]

5-Mar-09 15:18
2595kib2Geomol: thanks, that will be a lot more complicated for my case.5-Mar-09 15:01
2594GeomolThere's a lot of REBOL One-liners here, you might find amusing: 14:57
2593Geomol*Ops*5-Mar-09 14:49
2592GeomolUps, was that a one-line paint program? ;-P5-Mar-09 14:47
2591Geomolview layout [box 400x400 effect [draw [line]] feel [engage: func [f a e] [if a = 'over [append f/effect/draw e/offset show f]]]]

Try paint with the mouse.

5-Mar-09 14:45
2590GeomolIf I understand you correct, then I do that in Canvas RPaint, so yes. Have you tried that paint program?5-Mar-09 14:42
2589kib2Is it possible to draw something inside an over function (in a GUI app) ?5-Mar-09 14:30
2588kib2Brock : done!5-Mar-09 13:19
2587kib2Brock: yes, I already had that in mind. Next release :)5-Mar-09 13:08
2586BrockCan the two Series blocks not be combined into one list on the right side of the page?5-Mar-09 13:07
2585GeomolMaybe (follow) should be (continued)? What does the english-speaking here say?5-Mar-09 13:03
2584GeomolLooks good! :-)5-Mar-09 13:02
2583kib2CheatSheet Updated to v1.2 . Geomol: that makes sense to me, but sure that may be confusing. But it's not a problem on this sheet, just don't take the second column into account.5-Mar-09 12:59
2582GeomolEven as an experienced REBOL programmer, I seldom look at those things. It's only in cases, where I need utterly performance, or if I wanna see, what some function does.5-Mar-09 12:57
2581GeomolI'm wondering, if it's important for a newbie to the language to distinguish between natives, actions and functions. Wouldn't it just confure more?5-Mar-09 12:55
2580Henrikit's probably a good idea to keep separate sheets for R2 and R3, since some functions have moved from mezzanine to native and vice versa in R3.5-Mar-09 12:40
2579kib2Ok, great suggestions !5-Mar-09 12:36
2578HenrikActually there are also action! types, which are related to natives.

Perhaps one-letter identification in a separate column:

N = Native, A = Action, F = Function, M = Modifies Input, etc.

5-Mar-09 12:32
2577kib2hum... I've made some rules in my OO calc sheet to set some styles (ie color a line on two), and if I had native/mezzanines it will break all. I've to find an issue.: maybe add a column for that.5-Mar-09 12:29
2576Henrikfor R3 there will also be information about whether the function modifies the input. that would be useful as well.5-Mar-09 12:25
2575Henrikthat simplifies things a bit5-Mar-09 12:22
2574kib2Yes, that's a better way I think5-Mar-09 12:22
2573Henriksince you have created the sheet manually (if I'm correct), I would create a block with the words in the sheet in the order as shown on the sheet and then do something like:

foreach word words [ print [word type? get word] ]

5-Mar-09 12:21
2572kib2oops, sorry I didn't look at the output5-Mar-09 12:20
2571kib2Sorry, I should have said "among all those words", I don't want to type them one by one !5-Mar-09 12:18
2570Henrikpekr, yes it's similar.5-Mar-09 12:17
2569Henrik? native! is a good one.5-Mar-09 12:15
2568kib2Henrik: good idea. How can I know easily wich ones are mezzanines ?5-Mar-09 12:14
2567Henrikkib2, you could also color code them, for example by native and mezzanine.5-Mar-09 12:13
2566kib2I've updated the page and the cheatsheet: . You'll also find the original ods file.5-Mar-09 12:08
2565kib2Henrik: Hi. Really ? Ok, no problem.5-Mar-09 8:40

Return to Index Page