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

[ALLY] new functions?

From: bobr:dprc at: 11-Apr-2001 2:39

anton, this is a good function to be part of /core too. [thus I crosspost to both lists] I had proposed an earlier one called 'default.
>if not value? 'default [ > >default: func ['w1 [any-word!] v2 [ any-type! ] ] > [ if not value? w1 [ set/any w1 v2 ] ] > ]
it does more than reduce code size. it is most useful when you want to set up sample values that make rebol scripts runnable without editing just by 'do -ing them from another script. perhaps you can get both pieces of functionality by adding a default/ifnone refinement (maybe a default/none?) and by changing it to allow a path. I have this 'default function in wiki.r and several other places. notice that it too can have a better one instantiated before it is defined. 'default allows building on the work of others without altering their code. by having a word like 'default in obvious places in your script you can also build a configuration tool/gui for editing these defaults. you could be the author of such a universal app-configurator! I know of no other language that lets you [portably] edit remote application startup configuration parameters without knowing anything about the application other than the word 'default. that alone should wow rebol wannabees! At 03:08 PM 4/11/01 +1000, anton wrote:
>Hi, > >I was just looking at this code, which seems to occur often: > > if not system/view/highlight-start [ > system/view/highlight-start: system/view/caret > ] > >and I wonder if new functions could be made to shorten such; >- not?set >- none?set > >usage example: > > not?set system/view/highlight-start system/view/caret > >not?set should take two arguments, the first the value >to test and change, the second the value to change it to. > >I reckon something like this could reduce a lot of code; >it seems that long paths occur often in the system object. > >Or maybe there is a better, more flexible way? > >Anton. >-- >To unsubscribe from this list, please send an email to >[ally-request--rebol--com] with "unsubscribe" in the >subject, without the quotes.
;# mailto: [bobr--dprc--net]