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

[REBOL] Re: Perl is to stupid to understand this 1 liner.

From: joel:neely:fedex at: 16-Dec-2001 2:24

Hi, Carl, Context is all... Carl Read wrote:
> On 15-Dec-01, Joel Neely wrote: > > > Of course, I could define variables to hold the parts of the RE > > and give them mnemonic names ...
...
> > Perhaps that would be more readable to some? > > Even without the comments it at least lets you know it's doing > something with phone numbers... > > > What would one do in REBOL to make PARSE rules more obvious ... > > Well, this is how we're more or less supposed to write REBOL > code... >
... 26 lines snipped ...
> ...and of course nearly always do. (; >
I think a big issue is the setting in which the code is written; I'd certainly write differently in a book/tutorial/article for beginners (where the assumption is that every detail NEEDS to be explained) than in my normal work setting (where the assumption is that my collegues are all fairly skilled programmers). In the latter case, I suspect that # # hide US phone numbers, with optional area codes # s/\b(\d{3}-)?\d{3}-\d{4}\b/####/g; is quite adequate. I guess I see it as the string-processing analogue of something like the following: my $DAYS_TO_LIVE = 45; # delete log entries after this ... my $expiration = $DAYS_TO_LIVE * 24 * 60 * 60 + time; Where I expect a professional programmer to know * that time is in seconds since epoch, * hours per day, minutes per hour, and seconds per minute, * that $DAYS_TO_LIVE is the only number capable of being revised by a change in policy. And all of the work of defining names for the obvious (and immutable!) constants doesn't add any real value. However, audience is critical, and YMMV! -jn-