On Sat, May 16, 2020 at 03:19:05PM -0700, ToddAndMargo via perl6-users wrote:
> On 2020-05-16 06:38, Peter Pentchev wrote:
> > > $ raku *-e* "your one-liner script here"
> > And also you might want to put some quotes around the paths to let Raku
> > know that those are strings and not some identifiers or something.
> > 
> > G'luck,
> > Peter
> > 
> 
> Hi Peter,
> 
> This is what goofed me up:
> 
> $ alias p5
> alias p5='perl -E'
> 
> $ alias p6
> alias p6='perl6 -e'
> 
> I have no such feature on the Windows side and had
> forgot about it.
> 
> Also, if you tack a .Bool on the end of IO.d, you
> get back True or False, instead of the useless True
> or Crash.  I updates my perl6.IO.txt keeper file.
> 
> And IO.e also works for directories

What you're doing with "tacking .Bool at the end" is usually not
necessary to do explicitly, because most people do not "say" the result
of .d or .e, but use it in an if, for, while or some such conditional
statement, in which case Raku automatically converts the expression to
a boolean, i.e. tacks a .Bool at the end.

The reason .d and .e return a failure otherwise is that in some cases
they may be used not in a conditional statement, but as a kind of
assertion - "I really, really think that at this point this variable
should contain a valid path to an existing directory, but if something
went wrong in my program and the variable does not contain that, I do
not want the program to go on, it would be useless, I *want* it to raise
an exception when the value is used". At least that's what I think;
I *know* that the people who rewrote .IO in v6.d are on this list, so
please correct me if I'm wrong :)

But the most common use of .d, .e, .f and similar, the most common by
a very large margin, is in conditionals, where Raku does the conversion
to a boolean value automatically.

G'luck,
Peter

-- 
Peter Pentchev  r...@ringlet.net r...@debian.org p...@storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

Attachment: signature.asc
Description: PGP signature

Reply via email to