Re: 3 kinds of yadda

[email protected] (Trey Harris) Mon, 10 Sep 2018 16:48:50 -0400
Newsgroups perl.perl6.language
Message-ID <CALKJ+EtGVf1_bAmwTwmj191M8pu7wz4aC3jLJuvwB4YwBetCGQ@mail.gmail.com>
--000000000000ba704905758a7c4d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

When executed:

   - ??? is warn.- ... is fail.
   - !!! is =E2=80=98die`.

Otherwise, they=E2=80=99re identical (notably, when *not* executed, which i=
s the
usual case). You=E2=80=99d use ??? when you=E2=80=99re not implementing som=
ething yet but
it needs to be callable (say, a debugging function).

Given the difference in behavior between fail and die (fail is an unthrown
exception which is suppressed unless called in Sink context or used in an
expression as anything but a Failure or to test truth or definedness), I=E2=
=80=99d
suggest that !!! be used in a block that=E2=80=99s being used for its retur=
n value
(unless =E2=80=9Calways false and undefined=E2=80=9D is an acceptable retur=
n value until
you get around to implementing it and you want to be able to call it in the
meantime), and ... elsewhere.

sub warner() { ??? }

my $x =3D warner(); # "Stub code executed" warning here
say "Hi!"; # Hi! is printed.

vs.

sub failer() { ... }

my $x =3D failer(); # nothing happens yet
say "Hi!"; # Hi! will be printed
say $x; # "Stub code executed" will be thrown here.

vs.

sub dier() { !!! }

my $x =3D dier(); # code will stop execution here with a "Stub code
executed" exception
say "Hi!"; # never gets here

=E2=80=8B

On Mon, Sep 10, 2018 at 4:22 PM yary <[email protected]> wrote:

> Semantically
>  !!! is "if control flow hits here, it's an error"
>  ... is "The implementation is elsewhere, or this is not yet implemented"
>
> at least that's my impression
>
> -y
>
> On Mon, Sep 10, 2018 at 12:04 PM, Parrot Raiser <[email protected]>
> wrote:
>
>> There are 3 kinds of yadda, yadda operator:
>>
>> !!! dies with a message: Stub code executed
>>   in block <unit> at yad1 line 2
>>
>> ... dies with an identical message
>>
>> ??? produces the message, but continues operating.
>>
>> The only difference I can find between !!! and ... is that !!!
>> produces bizarre behaviour  when run from the command line. (Bash
>> appears to be editing the code before P6 sees it.)
>>
>> What is supposed to be the difference between !!! and ...? (And bonus
>> points if you can explain what bash is doing.)
>>
>
>

--000000000000ba704905758a7c4d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"markdown-here-wrapper" style=3D""><p style=
=3D"margin:0px 0px 1.2em!important">When executed:</p>
<ul style=3D"margin:1.2em 0px;padding-left:2em">
<li style=3D"margin:0.5em 0px"><code style=3D"font-size:0.85em;font-family:=
&quot;Fira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospace=
;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid =
rgb(234,234,234);background-color:rgb(253,246,227);border-radius:3px;displa=
y:inline">???</code> is <code style=3D"font-size:0.85em;font-family:&quot;F=
ira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospace;margin=
:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234=
,234,234);background-color:rgb(253,246,227);border-radius:3px;display:inlin=
e">warn</code>.- <code style=3D"font-size:0.85em;font-family:&quot;Fira Cod=
e&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospace;margin:0px 0.=
15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,23=
4);background-color:rgb(253,246,227);border-radius:3px;display:inline">...<=
/code> is <code style=3D"font-size:0.85em;font-family:&quot;Fira Code&quot;=
,LiberationMono,Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;pa=
dding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);back=
ground-color:rgb(253,246,227);border-radius:3px;display:inline">fail</code>=
.</li>
<li style=3D"margin:0.5em 0px"><code style=3D"font-size:0.85em;font-family:=
&quot;Fira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospace=
;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid =
rgb(234,234,234);background-color:rgb(253,246,227);border-radius:3px;displa=
y:inline">!!!</code> is =E2=80=98die`.</li>
</ul>
<p style=3D"margin:0px 0px 1.2em!important">Otherwise, they=E2=80=99re iden=
tical (notably, when <em>not</em> executed, which is the usual case). You=
=E2=80=99d use <code style=3D"font-size:0.85em;font-family:&quot;Fira Code&=
quot;,LiberationMono,Consolas,Inconsolata,Courier,monospace;margin:0px 0.15=
em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234)=
;background-color:rgb(253,246,227);border-radius:3px;display:inline">???</c=
ode> when you=E2=80=99re not implementing something yet but it needs to be =
callable (say, a debugging function).</p>
<p style=3D"margin:0px 0px 1.2em!important">Given the difference in behavio=
r between <code style=3D"font-size:0.85em;font-family:&quot;Fira Code&quot;=
,LiberationMono,Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;pa=
dding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);back=
ground-color:rgb(253,246,227);border-radius:3px;display:inline">fail</code>=
 and <code style=3D"font-size:0.85em;font-family:&quot;Fira Code&quot;,Libe=
rationMono,Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding=
:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);backgroun=
d-color:rgb(253,246,227);border-radius:3px;display:inline">die</code> (<cod=
e style=3D"font-size:0.85em;font-family:&quot;Fira Code&quot;,LiberationMon=
o,Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3e=
m;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:r=
gb(253,246,227);border-radius:3px;display:inline">fail</code> is an unthrow=
n exception which is suppressed unless called in Sink context or used in an=
 expression as anything but a Failure or to test truth or definedness), I=
=E2=80=99d suggest that <code style=3D"font-size:0.85em;font-family:&quot;F=
ira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospace;margin=
:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234=
,234,234);background-color:rgb(253,246,227);border-radius:3px;display:inlin=
e">!!!</code> be used in a block that=E2=80=99s being used for its return v=
alue (unless =E2=80=9Calways false and undefined=E2=80=9D is an acceptable =
return value until you get around to implementing it and you want to be abl=
e to call it in the meantime), and <code style=3D"font-size:0.85em;font-fam=
ily:&quot;Fira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monos=
pace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px so=
lid rgb(234,234,234);background-color:rgb(253,246,227);border-radius:3px;di=
splay:inline">...</code> elsewhere.</p>
<pre style=3D"font-size:0.85em;font-family:&quot;Fira Code&quot;,Liberation=
Mono,Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em=
;overflow:auto;margin:1.2em 0px"><code style=3D"font-size:0.85em;font-famil=
y:&quot;Fira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospa=
ce;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px soli=
d rgb(234,234,234);background-color:rgb(253,246,227);border-radius:3px;disp=
lay:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid=
 rgb(204,204,204);padding:0.5em 0.7em;display:block!important">sub warner()=
 { ??? }

my $x =3D warner(); # &quot;Stub code executed&quot; warning here
say &quot;Hi!&quot;; # Hi! is printed.
</code></pre><p style=3D"margin:0px 0px 1.2em!important">vs.</p>
<pre style=3D"font-size:0.85em;font-family:&quot;Fira Code&quot;,Liberation=
Mono,Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em=
;overflow:auto;margin:1.2em 0px"><code style=3D"font-size:0.85em;font-famil=
y:&quot;Fira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospa=
ce;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px soli=
d rgb(234,234,234);background-color:rgb(253,246,227);border-radius:3px;disp=
lay:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid=
 rgb(204,204,204);padding:0.5em 0.7em;display:block!important">sub failer()=
 { ... }

my $x =3D failer(); # nothing happens yet
say &quot;Hi!&quot;; # Hi! will be printed
say $x; # &quot;Stub code executed&quot; will be thrown here.
</code></pre><p style=3D"margin:0px 0px 1.2em!important">vs.</p>
<pre style=3D"font-size:0.85em;font-family:&quot;Fira Code&quot;,Liberation=
Mono,Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em=
;overflow:auto;margin:1.2em 0px"><code style=3D"font-size:0.85em;font-famil=
y:&quot;Fira Code&quot;,LiberationMono,Consolas,Inconsolata,Courier,monospa=
ce;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px soli=
d rgb(234,234,234);background-color:rgb(253,246,227);border-radius:3px;disp=
lay:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid=
 rgb(204,204,204);padding:0.5em 0.7em;display:block!important">sub dier() {=
 !!! }

my $x =3D dier(); # code will stop execution here with a &quot;Stub code ex=
ecuted&quot; exception
say &quot;Hi!&quot;; # never gets here
</code></pre><div title=3D"MDH:V2hlbiBleGVjdXRlZDo8ZGl2Pjxicj48L2Rpdj48ZGl2=
Pi0gYD8/P2AgaXMgYHdhcm5gLjxkaXY+
LSBgLi4uYCBpcyBgZmFpbGAuPC9kaXY+PGRpdj4tIGAhISFgIGlzICdkaWVgLjwvZGl2PjwvZGl=
2
PjxkaXY+PGJyPjwvZGl2PjxkaXY+T3RoZXJ3aXNlLCB0aGV5J3JlIGlkZW50aWNhbCAobm90YWJ=
s
eSwgd2hlbiBfbm90XyBleGVjdXRlZCwgd2hpY2ggaXMgdGhlIHVzdWFsIGNhc2UpLiBZb3UnZCB=
1
c2UgYD8/P2Agd2hlbiB5b3UncmUgbm90IGltcGxlbWVudGluZyBzb21ldGhpbmcgeWV0IGJ1dCB=
p
dCBuZWVkcyB0byBiZSBjYWxsYWJsZSAoc2F5LCBhIGRlYnVnZ2luZyBmdW5jdGlvbikuPC9kaXY=
+
PGRpdj48YnI+PC9kaXY+PGRpdj5HaXZlbiB0aGUgZGlmZmVyZW5jZSBpbiBiZWhhdmlvciBiZXR=
3
ZWVuIGBmYWlsYCBhbmQgYGRp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EiOyAjIEhpISB3aWx=
s
IGJlIHByaW50ZWQ8L2Rpdj48ZGl2PnNheSAkeDsgIyAiU3R1YiBjb2RlIGV4ZWN1dGVkIiB3aWx=
s
IGJlIHRocm93biBoZXJlLjwvZGl2PjxkaXY+YGBgPC9kaXY+PGRpdj52cy48L2Rpdj48ZGl2PmB=
g
YDwvZGl2PjxkaXY+c3ViIGRpZXIoKSB7ICEhISB9PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5=
t
eSAkeCA9IGRpZXIoKTsgIyBjb2RlIHdpbGwgc3RvcCBleGVjdXRpb24gaGVyZSB3aXRoIGEgIlN=
0
dWIgY29kZSBleGVjdXRlZCIgZXhjZXB0aW9uPC9kaXY+PGRpdj5zYXkgIkhpISI7ICMgbmV2ZXI=
g
Z2V0cyBoZXJlPC9kaXY+PGRpdj5gYGA8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2Pjxicj48L2R=
p
dj4=3D" style=3D"height:0;width:0;max-height:0;max-width:0;overflow:hidden;=
font-size:0em;padding:0;margin:0">=E2=80=8B</div></div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr">On Mon, Sep 10, 2018 at 4:22 PM yary &lt;=
<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Semantically<div>=C2=A0=
!!! is &quot;if control flow hits here, it&#39;s an error&quot;<div>=C2=A0.=
.. is &quot;The implementation is elsewhere, or this is not yet implemented=
&quot;</div><div><br></div><div>at least that&#39;s my impression=C2=A0</di=
v></div></div><div class=3D"gmail_extra"></div><div class=3D"gmail_extra"><=
br clear=3D"all"><div><div class=3D"m_-3290568066334076671gmail_signature" =
data-smartmail=3D"gmail_signature">-y<br></div></div></div><div class=3D"gm=
ail_extra">
<br><div class=3D"gmail_quote">On Mon, Sep 10, 2018 at 12:04 PM, Parrot Rai=
ser <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_=
blank">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex">There are 3 kinds of yadda, yadda operator:<br>
<br>
!!! dies with a message: Stub code executed<br>
=C2=A0 in block &lt;unit&gt; at yad1 line 2<br>
<br>
... dies with an identical message<br>
<br>
??? produces the message, but continues operating.<br>
<br>
The only difference I can find between !!! and ... is that !!!<br>
produces bizarre behaviour=C2=A0 when run from the command line. (Bash<br>
appears to be editing the code before P6 sees it.)<br>
<br>
What is supposed to be the difference between !!! and ...? (And bonus<br>
points if you can explain what bash is doing.)<br>
</blockquote></div><br></div></blockquote></div>

--000000000000ba704905758a7c4d--