Jump to page: 1 211  
Page
Thread overview
$`, $', $&, $n - sugar or cyclamates?
Feb 15, 2006
Walter Bright
Feb 15, 2006
Hasan Aljudy
Feb 15, 2006
Ameer Armaly
Feb 15, 2006
Trevor Parscal
Feb 15, 2006
Derek Parnell
Feb 15, 2006
Sean Kelly
Feb 16, 2006
Walter Bright
Feb 15, 2006
Tom
Feb 16, 2006
John Demme
Feb 16, 2006
Walter Bright
Feb 16, 2006
pragma
Feb 16, 2006
Walter Bright
Feb 16, 2006
Ivan Senji
Feb 17, 2006
Walter Bright
Feb 16, 2006
Dave
Feb 16, 2006
jicman
Feb 16, 2006
jicman
Feb 16, 2006
S. Chancellor
Feb 16, 2006
Derek Parnell
Feb 16, 2006
Walter Bright
Feb 16, 2006
Kris
Feb 16, 2006
Walter Bright
Feb 16, 2006
Oskar Linde
Feb 16, 2006
Walter Bright
Feb 16, 2006
pragma
Feb 16, 2006
kris
Feb 16, 2006
Sean Kelly
Feb 16, 2006
Sean Kelly
Feb 16, 2006
Oskar Linde
Feb 16, 2006
Sean Kelly
Feb 16, 2006
Oskar Linde
Feb 16, 2006
Sean Kelly
Feb 17, 2006
Walter Bright
Feb 17, 2006
Oskar Linde
Feb 17, 2006
pragma
Feb 17, 2006
Oskar Linde
Feb 17, 2006
Walter Bright
Feb 17, 2006
Fredrik Olsson
Feb 17, 2006
Sean Kelly
Feb 17, 2006
Sai
Feb 17, 2006
Ivan Senji
Feb 18, 2006
Georg Wrede
Feb 18, 2006
Kris
Feb 18, 2006
Sean Kelly
Feb 18, 2006
Kris
Feb 18, 2006
Sean Kelly
Feb 17, 2006
Deewiant
Feb 16, 2006
kris
Feb 16, 2006
Walter Bright
Re: $`, $', $&, $n - sugar or cyclamates? And other topics
Feb 16, 2006
kris
Feb 16, 2006
Sean Kelly
Feb 16, 2006
Thomas Kuehne
Feb 16, 2006
Sean Kelly
Feb 17, 2006
Kris
Feb 17, 2006
Sean Kelly
Feb 17, 2006
Kris
Feb 17, 2006
Regan Heath
Feb 17, 2006
Sean Kelly
Feb 17, 2006
Walter Bright
Feb 17, 2006
Derek Parnell
Feb 17, 2006
Walter Bright
Feb 17, 2006
Derek Parnell
Feb 17, 2006
Kris
Feb 17, 2006
Derek Parnell
Feb 17, 2006
Bruno Medeiros
Feb 18, 2006
Regan Heath
Feb 17, 2006
Walter Bright
Feb 17, 2006
Sean Kelly
Feb 17, 2006
Walter Bright
Feb 17, 2006
Sean Kelly
Feb 17, 2006
Walter Bright
Feb 17, 2006
Sean Kelly
Feb 18, 2006
Walter Bright
Feb 17, 2006
Kris
Feb 17, 2006
Walter Bright
Feb 17, 2006
Kris
Feb 17, 2006
Walter Bright
Feb 17, 2006
Sean Kelly
Feb 17, 2006
Walter Bright
Feb 17, 2006
Georg Wrede
Feb 17, 2006
Walter Bright
Feb 17, 2006
Georg Wrede
Feb 17, 2006
Walter Bright
Feb 20, 2006
James Dunne
Feb 17, 2006
Georg Wrede
Feb 17, 2006
Georg Wrede
Feb 17, 2006
Walter Bright
Feb 16, 2006
Sean Kelly
Feb 17, 2006
Walter Bright
Feb 16, 2006
James Dunne
Feb 16, 2006
Roberto Mariottini
Feb 16, 2006
Oskar Linde
Feb 16, 2006
Walter Bright
Feb 17, 2006
Oskar Linde
Feb 17, 2006
Walter Bright
Feb 16, 2006
bobef
Feb 16, 2006
Charles
Feb 16, 2006
David Medlock
Feb 17, 2006
Walter Bright
Feb 17, 2006
Hasan Aljudy
February 15, 2006
D dramatically improves the convenience of string handling over C++. But while I think using the library std.regexp is straightforward, obviously it just isn't gaining traction. People like the shortcut approaches Ruby and Perl use for regular expressions, hence the new D match-expression support.

So, now we have:

    if (regular_expression ~~ string)
    {
            _match.pre
            _match.post
            _match.match(n)
    }

Should we do some aliases:

    $` => _match.pre
    $' => _match.post
    $& => _match.match(0)
    $n => _match.match(n)

? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable?


February 15, 2006
Walter Bright wrote:
> D dramatically improves the convenience of string handling over C++. But while I think using the library std.regexp is straightforward, obviously it just isn't gaining traction. People like the shortcut approaches Ruby and Perl use for regular expressions, hence the new D match-expression support.
> 
> So, now we have:
> 
>     if (regular_expression ~~ string)
>     {
>             _match.pre
>             _match.post
>             _match.match(n)
>     }
> 
> Should we do some aliases:
> 
>     $` => _match.pre
>     $' => _match.post
>     $& => _match.match(0)
>     $n => _match.match(n)
> 
> ? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable? 
> 
> 

I don't have much todo with regexes .. but please .. the $ sign is ugly!!
February 15, 2006
"Walter Bright" <newshound@digitalmars.com> wrote in message news:dt088e$1svm$2@digitaldaemon.com...
>D dramatically improves the convenience of string handling over C++. But while I think using the library std.regexp is straightforward, obviously it just isn't gaining traction. People like the shortcut approaches Ruby and Perl use for regular expressions, hence the new D match-expression support.
>
> So, now we have:
>
>    if (regular_expression ~~ string)
>    {
>            _match.pre
>            _match.post
>            _match.match(n)
>    }
>
> Should we do some aliases:
>
>    $` => _match.pre
>    $' => _match.post
>    $& => _match.match(0)
>    $n => _match.match(n)
>
> ? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable? Hmm... I don't do much with regular expressions, but the presence of too much sugar can be counterproductive; I personally think the standard lib is the place for that kind of thing.
>
> 


February 15, 2006
In article <dt088e$1svm$2@digitaldaemon.com>, Walter Bright says...
>
>D dramatically improves the convenience of string handling over C++. But while I think using the library std.regexp is straightforward, obviously it just isn't gaining traction. People like the shortcut approaches Ruby and Perl use for regular expressions, hence the new D match-expression support.
>
>So, now we have:
>
>    if (regular_expression ~~ string)
>    {
>            _match.pre
>            _match.post
>            _match.match(n)
>    }
>
>Should we do some aliases:
>
>    $` => _match.pre
>    $' => _match.post
>    $& => _match.match(0)
>    $n => _match.match(n)
>
>? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable?
>
>

Leave the $ sign for scripting languages...

Thanks,
Trevor Parscal
February 15, 2006
On Wed, 15 Feb 2006 13:59:33 -0800, Walter Bright wrote:

> D dramatically improves the convenience of string handling over C++. But while I think using the library std.regexp is straightforward, obviously it just isn't gaining traction. People like the shortcut approaches Ruby and Perl use for regular expressions, hence the new D match-expression support.
> 
> So, now we have:
> 
>     if (regular_expression ~~ string)
>     {
>             _match.pre
>             _match.post
>             _match.match(n)
>     }

Thanks for this Walter. Although it adds no new functionality to
applications, it does say that D is a serious player in making string
handling programs easier to write and maintain. I expect that std.regexp
will still stay around and that this new feature is merely a portal into
that library.

> Should we do some aliases:
> 
>     $` => _match.pre
>     $' => _match.post
>     $& => _match.match(0)
>     $n => _match.match(n)
> 
> ? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable?

My first thought was "ouch! - not pleasant". After some consideration I'm now leaning towards the idea that we should hold off on implementing these shortcuts for now and wait to see if they are actually required or not. And then, if there is a crying need for them, to come up with a set of shortcuts that will be acceptable enough.

Currently the '$' symbol is associated with arrays and lengths, and not as a general purpose lead-in character to symbol values. To mix these two disparate concepts in coders minds might not be fruitful. However, there may be other alternatives yet to be discovered, so the concept ought not to be totally abandoned just yet.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
16/02/2006 10:32:50 AM
February 15, 2006
Derek Parnell wrote:
> On Wed, 15 Feb 2006 13:59:33 -0800, Walter Bright wrote:
>  
>> Should we do some aliases:
>>
>>     $` => _match.pre
>>     $' => _match.post
>>     $& => _match.match(0)
>>     $n => _match.match(n)
>>
>> ? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable?
> 
> My first thought was "ouch! - not pleasant". After some consideration I'm
> now leaning towards the idea that we should hold off on implementing these
> shortcuts for now and wait to see if they are actually required or not. And
> then, if there is a crying need for them, to come up with a set of
> shortcuts that will be acceptable enough. 

Agreed.

> Currently the '$' symbol is associated with arrays and lengths, and not as
> a general purpose lead-in character to symbol values. To mix these two
> disparate concepts in coders minds might not be fruitful. However, there
> may be other alternatives yet to be discovered, so the concept ought not to
> be totally abandoned just yet.

And this was my concern too.  But perhaps this is a bridge best left ignored until there's a reason to jump.


Sean
February 15, 2006
In article <dt088e$1svm$2@digitaldaemon.com>, Walter Bright says...
>
>D dramatically improves the convenience of string handling over C++. But while I think using the library std.regexp is straightforward, obviously it just isn't gaining traction. People like the shortcut approaches Ruby and Perl use for regular expressions, hence the new D match-expression support.
>
>So, now we have:
>
>    if (regular_expression ~~ string)
>    {
>            _match.pre
>            _match.post
>            _match.match(n)
>    }
>
>Should we do some aliases:
>
>    $` => _match.pre
>    $' => _match.post
>    $& => _match.match(0)
>    $n => _match.match(n)
>
>? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable?

On the contrary I think "$" is a very valuable symbol and should be used. Though the symbol "`" is very inconvenient (at least for spanish keyboard layout), ugly and could lead to confusion with "'" symbol - as I've seen many times and which I personally don't like to see used in such a way as "$'" -.

Maybe "$[" and "$]", don't know.

Just my opinion,

Tom;
February 16, 2006
Walter Bright wrote:
> 
> Should we do some aliases:
> 
>     $` => _match.pre
>     $' => _match.post
>     $& => _match.match(0)
>     $n => _match.match(n)
> 
> ? Syntactic sugar is often a good idea, but at what point do they become cyclamates and cause cancer in laboratory animals? Will these $ tokens render D more accessible, but perhaps too unreadable?

Oh Bob no... Don't turn D into Perl.  I like the $ for short cuts and such, but please no random symbols.  I like $match.pre and $length, ect... but $& and $` don't mean anything to me!
February 16, 2006
"Derek Parnell" <derek@psych.ward> wrote in message news:15w2x5659i8ey$.p4zbzif24wfw$.dlg@40tude.net...
> Thanks for this Walter. Although it adds no new functionality to applications, it does say that D is a serious player in making string handling programs easier to write and maintain. I expect that std.regexp will still stay around and that this new feature is merely a portal into that library.

You're right in that all it really does is offer an easier way to get at std.regexp.

> My first thought was "ouch! - not pleasant". After some consideration I'm
> now leaning towards the idea that we should hold off on implementing these
> shortcuts for now and wait to see if they are actually required or not.
> And
> then, if there is a crying need for them, to come up with a set of
> shortcuts that will be acceptable enough.

That's why I didn't do them yet.


February 16, 2006
"John Demme" <me@teqdruid.com> wrote in message news:dt0fvp$23bj$1@digitaldaemon.com...
> Oh Bob no... Don't turn D into Perl.  I like the $ for short cuts and
> such,
> but please no random symbols.  I like $match.pre and $length, ect... but
> $&
> and $` don't mean anything to me!

<g>. I considered setting this up as a vote:

Vote for 1:

(1) If I wanted to write ugly programs I'd use Perl, not D.

(2) Cool! I can now dump my Perl scripts and use D!


« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11