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

Enumerated type creation

 [1/3] from: princepawn:lycos at: 5-Sep-2000 7:39


I want to constrain the input values for a string field to be either the words "cancel" or "nocancel". REBOL has excellent support for forcing a function argument to be date!, time!, string!, but I want to increase the restrictions for a particular field and have it throw an error on spurious input. Must I homebrew something or did I overlook the built-in support for this? --- ; run this in your ; <a href=http://www.rebol.com>REBOL</a> Interpreter! terrence-brannon: [ [princepawn--yahoo--com] perl-refugee myth-gamer ] perl-refugee: [ 'loved href perl discovery: (metaperl = rebol) 'hates href perl ] myth-gamer: http://www.bungie.net/bin/stats.pl?player=princepawn ; angles makes this a href instead of code! use ur imagination! href: func [U T] [ rejoin [ "a href=" U ">" T "/a" ] ] perl: href http://www.perl.com "Perl"

 [2/3] from: rebol:keithdevens at: 5-Sep-2000 10:57


This sounds like a job for Design by Contract. :) As far as I know the only thing you can do in rebol is check for those inputs and throw an error if the argument doesn't match one of them. Keith P.S. I wonder if Carl's ever looked at Eiffel and such for ideas for Rebol. I know he's dealt with a lot of languages, but I'm interested to find out if he's ever had any dealings with Eiffel and Design by Contract stuff... Sather has it also, although I haven't looked at it too much at all. ----- Original Message ----- From: <[princepawn--lycos--com]> To: <[list--rebol--com]> Cc: <[feedback--rebol--com]> Sent: Tuesday, September 05, 2000 10:39 AM Subject: [REBOL] Enumerated type creation
> I want to constrain the input values for a string field to be either the
words "cancel" or "nocancel".
> REBOL has excellent support for forcing a function argument to be date!,
time!, string!, but I want to increase the restrictions for a particular field and have it throw an error on spurious input.

 [3/3] from: al:bri:xtra at: 6-Sep-2000 17:00


> I want to constrain the input values for a string field to be either the
words "cancel" or "nocancel".
> REBOL has excellent support for forcing a function argument to be date!,
time!, string!, but I want to increase the restrictions for a particular field and have it throw an error on spurious input.
> Must I homebrew something or did I overlook the built-in support for this?
Change your design. Use two Radio buttons in Rebol/View. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/