Raku / problem-solving

🦋 Problem Solving, a repo for handling problems that require review, deliberation and possibly debate
Artistic License 2.0
70 stars 16 forks source link

Removed Syntactic Feature (-i flag for in-place file editing) #36

Open rehsack opened 5 years ago

rehsack commented 5 years ago

While digging into Perl6, I try to focus on users - those who use Perl 5 for some reason meanwhile, and how to catch them.

I found Perl Is Still The Goddess For Text Manipulation nowadays and walk over it. Unfortunately, -i has been removed (see https://github.com/perl6/specs/blob/master/S19-commandline.pod), because:

  -i *extension*
   Modify files in-place. Haven't thought about it enough to add yet, but I'm certain it has a strong following. {{TODO review decision here}}

When Perl 6 is still a Perl, this is a mandatory feature.

AlexDaniel commented 5 years ago

It is a frequently requested feature. I don't think there's any reason not to have, so somebody just needs to implement it.

rehsack commented 5 years ago

@lizmat suggested some kind of Hackathon - but we might need topics ;) This could be one of it...

AlexDaniel commented 5 years ago

Squashathon is currently in progress (21 hours left), any contributions to rakudo count, one winner gets a plush camelia :)

Just submit a PR with the thing. However, last time I looked at it, in-place editing turned out to be a bit harder to implement than it seems.

lizmat commented 5 years ago

If we want this, I guess we need to implement this in Perl 6 logic, possibly in module space. If that works, we can hook it into the default parameter parsing if we think that is still a good idea.

jnthn commented 5 years ago

I'm fine with -i being implemented and added to Rakudo; it should probably be spec'd (that is, spectests) also, as I believe other options like -n are.

lizmat commented 5 years ago

Then I suspect this is best implemented as a Perl 6 class taking the necessary parameters and producing the right output, and then hooking that into the parameter parsing logic?