New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding other bash file ops like '-nt, -ot, etc..' #16698
Comments
From perl-diddler@tlinx.orgCreated by perl-diddler@tlinx.orgIt seems that the various -X operators are intended to mirror I noticed that an operator like -nt was only implemented by which seems a bit obtuse. How difficult would it be to add the remaining file-compare I'm not suggesting the various string operators be implemented -- Thanks. Perl Info
|
From @leonerdOn Thu, 20 Sep 2018 06:10:09 -0700
I'd say that sounds terrible. Those -X operators are already somewhat I'd say a far better plan would be to just add some more methods to the use File::stat; stat("file1")->mtime > stat("file2")->mtime at which point, it has no back-compat problems and reads nicer to the stat("file1")->newer_than(stat("file2")) -- leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Thu, Sep 20, 2018 at 02:32:02PM +0100, Paul "LeoNerd" Evans wrote:
+1. Also, it's already valid syntax: $ perl -MO=Deparse -e'$f1 -nt $f2' $ perl -MO=Deparse -e'sub nt{} $f1 -nt $f2' -- |
From perl-diddler@tlinx.orgOn 9/20/2018 6:39 AM, Paul LeoNerd Evans via RT wrote:
Civility is simple: stick to the facts while avoiding demeaning remarks, While civility is required, kindness is encouraged; if you have any I submit that your statement was neither civil nor kind.
And that is a matter of opinion. Most people will learn shell programming Perl was designed to be a merge of shell and several of its utilities. That |
From perl-diddler@tlinx.orgOn 9/20/2018 7:20 AM, Dave Mitchell via RT wrote:
This is neither civil nor kind either. Your responses would no
No. That's inconsistent with how the current ops are parsed:
According to you, that should have been parsed $f1 - $f2->u
According to you, it should have been 'fine' The reality is that perl only parses in the ways you mention 2nd, the prefix form of calling a member has been semi-deprecated. Though if you can show either of the above constructs in the existing |
From andreas@guldstrand.infoOn Sat, 22 Sep 2018 at 12:34, L. Walsh <perl-diddler@tlinx.org> wrote:
Exactly! If you make -nt an operator it would cause that code to
This is precisely why it's backwards incompatible. -nt is not
I'm not sure what you mean by member here, but I'm going to assume you It has been -discouraged- by members of the perl community because it Secondly, when it comes to civility, you qouted something, I'm not sure what:
I don't see how Paul thinking that your idea was a terrible one is a |
From @iabynOn Sat, Sep 22, 2018 at 03:33:32AM -0700, L. Walsh wrote:
This wasn't a personal attack, it was agreement with an honest criticism
No it wouldn't. If you said for example, "that is a stupid idea and you
That's a personal attack. Also, you got banned for a long accumulation of
You're confusing unary and binary operators. All the current perl filetest My example was pointing out that your proposed syntax is ambiguous - it As another example, $f1-nt($f2) should that be parsed as a function call: This opens a can of worms for very little gain. Your example of a -nt operator can already be written easily as -- |
From perl-diddler@tlinx.orgOn 9/22/2018 4:38 AM, Dave Mitchell via RT wrote:
I didn't say it was a personal attack. I said it wasn't civil nor
Funny, when I asked for examples of violations none could be given.
I'm not confusing the ops -- I showed an example that is equally
$f1 -r($f2) -- is another example of a unary operator that has If "-r" is a valid operator, it is parsed one way,
There are tons of ways to write it, but none that would work both in |
From @khwilliamsonOn 09/23/2018 01:22 AM, L. Walsh wrote:
I don't believe the first replies to Linda were appropriate even if they Saying that something is a terrible idea without any supporting If someone doesn't have the time or patience to respond in depth, then I Karl Williamson |
From @iabynOn Sun, Sep 23, 2018 at 12:22:07AM -0700, L. Walsh wrote:
Ok, I apologise.
The existing filetest operators were added in perl 2, back when you had to The problem we would have in adding new filetest operators is that Also, the handling of the '-' token in the lexer is currently rather - as a unary negation operator Further, the lexer is sensitive to operator/term context, for example when $match_result = / .... # lexer returns match token By adding binary filetest ops, we have to make the lexer more sensitive to
Having syntax that works in both shell and perl is not a high priority Note also that perl has a whole bunch of filetest ops that bash doesn't My position on this proposal is that it adds very little usefulness to So I am not in favour of this proposal. -- |
From @TuxOn Tue, 25 Sep 2018 11:25:38 +0100, Dave Mitchell <davem@iabyn.com>
Additionally $- $ perl -MTime::Piece -wE'$_=Time::Piece->new;say$_--->week;'
-- |
From perl-diddler@tlinx.orgOn 9/25/2018 3:26 AM, Dave Mitchell via RT wrote:
1) To be clear, at this point, there are only 3 such operators: 2) At the least, one would have to enable the new operators via 'use 3) If it was decided to use -nt/-ot/-ef, those operators would be like
Looking at the man page in bash, I don't -M in the file operators Certain -z could be reconciled with -z returning 0 if the arg, as a file Unfortunately this is a case of selling a feature to perl-experts, Given the direction of perl's popularity among the non-perl-expert |
From m@rtij.nlOp 25-09-18 om 12:25 schreef Dave Mitchell:
As someone who works daily with sysadmins, engineers and developers, I Regards, |
Migrated from rt.perl.org#133533 (status was 'open')
Searchable as RT133533$
The text was updated successfully, but these errors were encountered: