Would it be possible to overload the hash-ref dereferencing operator
instead, so that we can get rid of the quotes as well? So we can have
$a->{(0),} instead of $a->('(0),')?  (I assume that you can indeed
overload ->{} and that perl will stringify contents without thinking
it's a regular arithmetic expression first... maybe this won't work :-P)
Tom


On Sat, Aug 18, 2012, at 09:05 AM, Joel Berger wrote:
> Hi again, I sent this to the PDLPorters list, but it seems that it
> didn't take. I'm resending to the perldl list and if that doesn't
> work, I'm not sure what's up.
> 
> Cheers,
> Joel
> 
> 
> ---------- Forwarded message ----------
> From: Joel Berger <[email protected]>
> Date: Fri, Aug 17, 2012 at 1:22 PM
> Subject: A slightly cleaner slice without source filters
> To: pdl-porters <[email protected]>
> 
> 
> Hi all,
> 
> David knows that I don't use NiceSlice because I worry about source
> filters, probably more than I should. Still given the recent problem
> on the list, I thought I would look again at the other options. I keep
> thinking that I want to drop a note to the developers of
> Devel::Declare to see if I could hook into the scalar opcode rather
> than keyword as D::D does now; if I could get that, then a NiceSlice
> would be easy to implement. Absent that, I hacked out this little
> thing this morning which saves 5 keystrokes.
> 
> (see at gist: https://gist.github.com/3379468)
> 
> #!/usr/bin/env perl
> 
> use strict;
> use warnings;
> 
> package PDL;
> use overload '&{}' => sub {
>   my $pdl = shift;
>   return sub { unshift @_, $pdl; goto &PDL::slice };
> };
> 
> package main;
> 
> use PDL;
> my $a = xvals(5,5);
> print $a->('(0),');
> 
> What do you all think?
> 
> Joel
> 
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to