Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#330 NiceSlice can get confused by comments to cause compilation errors

critical
open
None
4
2015-03-15
2013-04-22
dima
No

I hit another NiceSlice bug. I'm attaching a small perl program. It should "perl -c" just fine, however:

dima@shorty:/tmp$ perl -c /tmp/niceslice_significantcomment.pl

Possible unintended interpolation of @x in string at /tmp/niceslice_significantcomment.pl line 10.
syntax error at /tmp/niceslice_significantcomment.pl line 9, near "1:"
Global symbol "@x" requires explicit package name at /tmp/niceslice_significantcomment.pl line 10.
/tmp/niceslice_significantcomment.pl had compilation errors.

Surprisingly enough, the culprit is the comment on line 6. This is confusing NiceSlice. Removing that comment makes it work.

Discussion

  • Chris Marshall
    Chris Marshall
    2013-04-22

    I don't see the attachment but the current PDL::NiceSlice filter doesn't ignore quoted strings or comments. NiceSlice-ish code in them are filtered or can confuse the filter. I have worked out the various issues but ran into various snags in implementation (some from bugs in needed dependencies and some from how to support niceslice filtering in the PDL shells) so it did not make the cut for PDL-2.006.

     
  • dima
    dima
    2013-04-22

    OK; it sounds like you're already familiar with these issues already. I'll attach the sample file anyway (I did attach it when posting; maybe SF is confused).

    Thanks.

     
  • Chris Marshall
    Chris Marshall
    2013-04-22

    Modifying your example to actually do something:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    #!/usr/bin/perl
    use strict;
    use warnings;
    use PDL;
    use PDL::NiceSlice;
    # $f(
    
    my $p = sequence(7);
    my @x = $p->(1:-1)->list;
    print "@x\n";
    

    and this is with the current Filter::Util::Call sourcefilter engine:

    $ perl niceslice_significantcomment.pl
    Possible unintended interpolation of @x in string at niceslice_significantcomment.pl line 10.
    syntax error at niceslice_significantcomment.pl line 9, near "1:"
    Global symbol "@x" requires explicit package name at niceslice_significantcomment.pl line 10.
    Execution of niceslice_significantcomment.pl aborted due to compilation errors.
    

    BUT this is with the current Filter::Simple engine which is mostly working:

    $ PDL_NICESLICE_ENGINE=Filter::Simple perl niceslice_significantcomment.pl 
    1 2 3 4 5 6
    

    Voila! It mostly works but not yet 100%. Nor does it work in the PDL shells.

    --Chris

     
  • Chris Marshall
    Chris Marshall
    2015-02-22

    The default engine for PDL::NiceSlice is now set to Filter::Simple to exercise the functionality. Still need an implementation that works for string/eval processing rather than just for source files.

     
  • Chris Marshall
    Chris Marshall
    2015-02-22

    Would like to see this closed for PDL-2.008

     
  • Chris Marshall
    Chris Marshall
    2015-02-22

    • assigned_to: Chris Marshall
    • Priority: 5 --> 7
     
  • Chris Marshall
    Chris Marshall
    2015-03-15

    Lower priority to 4. Plan to complete development in PDL-2.009 release cycle.

     
  • Chris Marshall
    Chris Marshall
    2015-03-15

    • Priority: 7 --> 4