develooper Front page | perl.perl6.language | Postings from April 2005

Re: Inline code (was: Closure/block/sub multiplier)

Thread Previous | Thread Next
From:
Luke Palmer
Date:
April 20, 2005 20:22
Subject:
Re: Inline code (was: Closure/block/sub multiplier)
Message ID:
20050421032350.GA19702@navi.cx
Juerd writes:
> It'd be fun to have a different spelling for comma (here I assume that
> leading comma is ignored and that because of the special new leading
> keyword, non-slurpy can come after slurpy), for example:
> 
>     multi eval ($code, "using" ?$lang) { eval($code, :lang($lang)) }
>     eval 'printf("Hello!")' using "C";
> 
>     multi index ("of" $needle, "in" $haystack, +$offset) { index(...) }
>     my $pos = index of "," in "Hello, world!";
> 
>     multi join (*@strings, "on" $separator) { ... }
>     my $joined = join @fields on ":";
>     
> The same thing can almost be done with pairs, but these words don't make
> good identifier names.

I believe this was an RFC at some point.  And this probably can't be
done without hard-to-construct regexes, but we'll leave that
construction to the module author so it only need be done once.  I don't
actually expect that it would be *that* hard to do.

Luke

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About