Ehehe, vou tentar contextualizar a minha lembrança... Tomo como exemplo a &quot;tabela-verdade&quot; do operador ~~ (&quot;smart matching&quot;, L&lt;perlsyn&gt;):<br clear="all"><br><span style="font-family: courier new,monospace;">           $a      $b        Type of Match Implied    Matching Code</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           ======  =====     =====================    =============</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Any     undef     undefined                !defined $a</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Any     Object    invokes ~~ overloading on $object, or dies</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Hash    CodeRef   sub truth for each key[1] !grep { !$b-&gt;($_) } keys %$a</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           Array   CodeRef   sub truth for each elt[1] !grep { !$b-&gt;($_) } @$a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Any     CodeRef   scalar sub truth          $b-&gt;($a)</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Hash    Hash      hash keys identical (every key is found in both hashes)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           Array   Hash      hash slice existence     grep { exists $b-&gt;{$_} } @$a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Regex   Hash      hash key grep            grep /$a/, keys %$b</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           undef   Hash      always false (undef can&#39;t be a key)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Any     Hash      hash entry existence     exists $b-&gt;{$a}</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Hash    Array     hash slice existence     grep { exists $a-&gt;{$_} } @$b</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           Array   Array     arrays are comparable[2]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Regex   Array     array grep               grep /$a/, @$b</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           undef   Array     array contains undef     grep !defined, @$b</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Any     Array     match against an array element[3]</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">                                                      grep $a ~~ $_, @$b</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           Hash    Regex     hash key grep            grep /$b/, keys %$a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Array   Regex     array grep               grep /$b/, @$a</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           Any     Regex     pattern match            $a =~ /$b/</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Object  Any       invokes ~~ overloading on $object, or falls back:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           Any     Num       numeric equality         $a == $b</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Num     numish[4] numeric equality         $a == $b</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">           undef   Any       undefined                !defined($b)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">           Any     Any       string equality          $a eq $b</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        1 - empty hashes or arrays will match.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        2 - that is, each element smart-matches the element of same index in the</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">            other array. [3]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        3 - If a circular reference is found, we fall back to referential equality.</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">        4 - either a real number, or a string that looks like a number</span><br style="font-family: courier new,monospace;"><br>Olha, não sei quanto aos outros participantes da lista, mas eu simplesmente não consigo me ater a todos esses detalhes <br>

:(<br>Então nunca uso esse operador que me confunde (<b>PARA MIM</b>, é um &quot;<i>Undefined Behavior</i>&quot;), preferindo fazer &quot;à moda antiga&quot; (última coluna). Enfim, sou desses caras que enchem qqer operação de ()&#39;s, tipo: ((($x / $y) - $z) &gt; 0).<br>

Enfim, o que quero dizer é que o Perl tem um imenso <b>potencial</b> de produzir código cheio de <i>Pseudo-undefined Behavior</i>; por que ninguém tem obrigação de saber todas as faces de todos os operadores; isso sem contar as L&lt;perlvar&gt;.<br>

<br>ABS()<br><br>
<br><br><div class="gmail_quote">2011/2/14 Blabos de Blebe <span dir="ltr">&lt;<a href="mailto:blabos@gmail.com">blabos@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Oras, isso me lembra<br>
<br>
<a href="http://www.ioccc.org/1987/wall.c" target="_blank">http://www.ioccc.org/1987/wall.c</a><br>
<br>
Uma coisa é você usar isso em um golf, outra é usar em código de produção.<br>
<br>
Tem gente que empeteca o código com meia dúzia de regexp e se ahca &#39;O<br>
Hackerzão&#39;.<br>
<br>
A maior parte dos bugs (com os quais estou lidando agora, por<br>
exemplo), teria sido evitada se fossem respeitados os padrões mínimos<br>
de boas práticas. Coisa que qualquer estagiário *deveria* sair da<br>
escolinha sabendo.<br>
<br>
Abraços<br>
<br>
2011/2/14 Stanislaw Pusep &lt;<a href="mailto:creaktive@gmail.com">creaktive@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Não sei pq, mas lembrei da seguinte sintaxe, compilável em Perl:<br>
&gt;<br>
&gt; -f&gt;@+?*&lt;.-&amp;&#39;_:$#/%!<br>
&gt;<br>
&gt; ABS()<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; 2011/2/14 Blabos de Blebe &lt;<a href="mailto:blabos@gmail.com">blabos@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; Bom dia,<br>
&gt;&gt;<br>
&gt;&gt; Sem querer entrar em flames, ou no mérito da discussão, que tomo<br>
&gt;&gt; apenas como exemplo.<br>
&gt;&gt;<br>
&gt;&gt; A thread abaixo é uma discussão que está acontecendo na principal<br>
&gt;&gt; lista de C++ brasileira, sobre undefined behavior.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://groups.google.com/group/ccppbrasil/browse_thread/thread/9b9a7be45917095e#" target="_blank">http://groups.google.com/group/ccppbrasil/browse_thread/thread/9b9a7be45917095e#</a><br>
&gt;&gt;<br>
&gt;&gt; Notem como o Undefined behavior deste exemplo em particular pode ser<br>
&gt;&gt; resolvido com &#39;codificação elegante&#39;. Ok, o assunto era outro e foi só<br>
&gt;&gt; um exemplo rápido, mas levantou a discussão que está acontecendo até<br>
&gt;&gt; agora.<br>
&gt;&gt;<br>
&gt;&gt; A maioria dos &#39;Undefined Behaviors&#39; das linguagens de programação que<br>
&gt;&gt; conheço (não são muitos) são casos específicos, incomuns, bem<br>
&gt;&gt; documentados, bem avisados, normalmente abertos por &#39;depender da<br>
&gt;&gt; implementação&#39; e invocados por código porco de programadores meia-boca<br>
&gt;&gt; (não que este caso de *exemplo* seja um).<br>
&gt;&gt;<br>
&gt;&gt; É claro, nenhuma linguagem é perfeita (exceto lisp), mas elas possuem<br>
&gt;&gt; especificações, mais abrangentes ou menos abrangentes. Por isso, não<br>
&gt;&gt; importa a linguagem, ou você se aprofunda e aprende, ou mais cedo ou<br>
&gt;&gt; mais tarte, vai acabar caindo em alguma dessas asrmadilhas.<br>
&gt;&gt;<br>
&gt;&gt; Na minha opinião, C tem mais armadilhas e/ou hacks que precisam de um<br>
&gt;&gt; pouco mais de conhecimento de arquitetura de computadores para escapar<br>
&gt;&gt; do que Perl, enquanto Perl tem outros tipos de armadilhas.<br>
&gt;&gt;<br>
&gt;&gt; Entenda armadilha aqui como &quot;algo que eu imaginava de um jeito, mas<br>
&gt;&gt; aconteceu de outro&quot;, independente da expectativa ser razoável ou não.<br>
&gt;&gt;<br>
&gt;&gt; O negócio é que como Perl é mais fácil de lidar do que C, você alcança<br>
&gt;&gt; as armadilhas de Perl mais cedo do que conseguiria caminhar em C para<br>
&gt;&gt; alcançar as suas, logo, Perl parece mais imprevisível.<br>
&gt;&gt;<br>
&gt;&gt; Abraços<br>
&gt;&gt; =begin disclaimer<br>
&gt;&gt;   Sao Paulo Perl Mongers: <a href="http://sao-paulo.pm.org/" target="_blank">http://sao-paulo.pm.org/</a><br>
&gt;&gt;  SaoPaulo-pm mailing list: <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
&gt;&gt;  L&lt;<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a>&gt;<br>
&gt;&gt; =end disclaimer<br>
&gt;<br>
&gt;<br>
&gt; =begin disclaimer<br>
&gt;   Sao Paulo Perl Mongers: <a href="http://sao-paulo.pm.org/" target="_blank">http://sao-paulo.pm.org/</a><br>
&gt;  SaoPaulo-pm mailing list: <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
&gt;  L&lt;<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a>&gt;<br>
&gt; =end disclaimer<br>
&gt;<br>
&gt;<br>
=begin disclaimer<br>
   Sao Paulo Perl Mongers: <a href="http://sao-paulo.pm.org/" target="_blank">http://sao-paulo.pm.org/</a><br>
 SaoPaulo-pm mailing list: <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
 L&lt;<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a>&gt;<br>
=end disclaimer<br>
</div></div></blockquote></div><br>