chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] "raw" strings


From: felix winkelmann
Subject: Re: [Chicken-users] "raw" strings
Date: Fri, 10 Oct 2008 16:20:58 +0200

On Fri, Oct 10, 2008 at 12:51 PM, Peter Bex <address@hidden> wrote:
> On Fri, Oct 10, 2008 at 04:36:02PM +0900, Alex Shinn wrote:
>> Peter Bex <address@hidden> writes:
>> > Could you give an example in which you need this?
>>
>> As a wild guess, regular expressions?  The syntax of regexps
>> is really horrible for any language which represents them as
>> plain strings.
>>
>> On the other hand something like Gauche's #/.../ or Ruby's
>> #rx{...} for a regular expression literal would be even more
>> convenient, and potentially allow for the trailing imsx
>> modifiers.
>
> We do have the regex-literals egg... Do you propose adding that to
> core Chicken?

The problem with regexp-literals is that they currently do not have an
internal representation, they are not real literal objects (they actually
point to some PCRE structure, and thus can not be compiled into
literals). Using #/.../ as read syntax for (delay (regexp ...)) doesn't
work, because the regexp might be embedded into a quoted s-expression.

I also don't like to re-invent all those horrible modifiers. If one wants
to pass special flags, "(regexp ...)" is more clear and easier
to read. If we just follow Perl here, we end up with source code
that is just as ugly. #"..." is a compromise that doesn't stand out
too much, and is compatible with the usual syntax-highlighting in
editors.


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]