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

[REBOL] Re: What language am I looking for?

From: joel:neely:fedex at: 15-May-2001 8:09

Hi, Ken and all, Ken Anthony wrote:
> > In my opinion, it is ok to overwrite words... > > Yes it is ok, but does it put more or less burden on the > programmer?... > > Here's an example of what I mean... If we change the default to no > reassignment we could use another symbol for explicit reassignment. > > word: [to assign] > word:: [to reassign] > > But I've always found double colons to be ugly. Any thoughts? >
We could go the other way and tackle the problem ourselves; leave the colon suffix as is and try something like the following (where the "p" presumably stands for "protected" or "paranoid" or even possibly ): REBOL/View/Pro 1.2.0.4.2 8-May-2001 Copyright 2000-2001 REBOL Technologies. All rights reserved. REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM Type DESKTOP or SET-USER for settings.
>> glorp: [this is a test]
== [this is a test]
>> pset: func [[catch] 'wref expr] [
[ either value? wref [ [throw make error! "Word already set!"] [ [set wref expr] [ ]
>> pset glorp [this is another test]
** User Error: Word already set! ** Near: pset glorp [this is another test]
>> pset glonk [this is another test]
== [this is another test]
>> glorp
== [this is a test]
>> glonk
== [this is another test]
>>
So that PSET will only SET words that currently have no value (that are valueless? that are clueless? Well, you know what I mean! ;-) -jn- -- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com