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

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

Thread Previous | Thread Next
Luke Palmer
April 20, 2005 20:22
Re: Inline code (was: Closure/block/sub multiplier)
Message ID:
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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About