Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Hitting the learning curve

From: nitsch-lists:netcologne at: 5-Nov-2003 15:49

Hi Ged, I have a Scratchpad.r where i start developing. Thats the blank screen or the form. In VB I start with a blank form, dropping controls and then writing the event handlers. my vb-blank-area (text-area with slider, quit-button): view layout[ buttin #"^q" "quit" [quit] slider 16x450 [scroll-para ta face] area 600x450 ] starts with hotkey from my editor. error: console, a quick "q" in the console quits and i am back in editor. In Java I start with an object model. I identify my objects with methods and properties and then start composing the relative classes. Not so necessary in rebol imho, because most of the usefull classes are inbuild and very flexible. In Perl or Ruby I start with the input stream, usually a file, and start heading for the output stream. me too. using 'save/all and 'load/all. Very usefull with rebol, because data is easy to structure (hierarchy of blocks), search and (!) to create by hand for debugging. my blank data-page: words: [files names something] ;persistent to load/save data-file: %scratchpad-data.txt save-data: does[save/all data-file reduce words] ;loading once at atart, so no func set words any[ attempt[load/all data-file] ; catchs errors, like "does not exist" reduce[[%a %b] ["the a file" "the b file] #a-something] ] to reset data-file i usually put a single "[" in, so the load fails, default values are used. So a blank page with gui and load/save is: ;;;;;;;;;;;;;;;; words: [files names something] ;persistent to load/save data-file: %scratchpad-data.txt save-data: does[save/all reduce words] ;loading once at atart, so no func set words any[ attempt[load/all data-file] ; catchs errors, "does not exist" etc. reduce[[%a %b] ["the a file" "the b file] #a-something] ] view layout[ buttin #"^q" "quit" [save-data quit] slider 16x450 [scroll-para ta face] area 600x450 ] ;;;;;;;;;;;;;; hacked a bit straightforward, have now a basic file-commenter used a lot "probe something" and "?? variable. usefull too: keep variables in global context while debugging. quick to look in. be carefull with "attempt[load someting]". it hides all errors. so it hides wrong filenames too. while debugging, you can set "attempt: :do" so attempt will break on errors. You can do "area/text: %file.r". but the filename is converted to string. will not be found in the initial file-block. so use "find files TO-STRING area/text" once file is stored, it will not look for new files. try to fix that. hints: union files read %./ appends, deletes doubles and keeps old order of first argument. insert/dup with the difference of two "length?" can be used to add "none"s to the comments-field. REBOL [Title: "Scratchpad - for developing"] words: [files comments] ;persistent to load/save data-file: %scratchpad-data.txt save-data: does [save/all data-file reduce words] ;loading once at start, so no func set words any [ attempt [load/all data-file] ; catchs errors, like "does not exist" reduce [ f: sort read %./ ;files head insert/dup copy [] none probe length? f ;a none-comment/file ] ] view layout [ button #"^q" "quit" [save-data quit] tl-files: text-list data files [ tf-file/text: first face/picked index: index? find files tf-file/text ta-comment/text: pick comments index show [tf-file ta-comment] ] return tf-file: info ta-comment: area [ index: index? find files to-file tf-file/text change at comments index copy ta-comment/text save-data ] ] ] ;-Volker Am Mittwoch, 5. November 2003 10:49 schrieb Ged Byrne: