# from Carl Mäsak
# on Sunday 14 September 2008 07:18:

>die "Unrecognized directive: TMPL_$directive"
>   if $directive ne 'VAR' | 'LOOP' | 'IF';
>
>One is tempted to assume that this means the same as 
>"$directive ne 'VAR' || $directive ne 'LOOP' || $directive ne 'IF'",
>but it doesn't. 

Actually, it does mean exactly that.

But you're not really tempted to read it as:

  if this isn't "var" or else this isn't "loop" or else this isn't "if"

(in denial?).  Instead, one is tempted to read it as:

  if this is not: 'var', 'loop', or 'if'

, by which you really mean:

  if this is not 'var' and this is not 'loop' and this is not 'if'
or:
  if not this is any of: 'var', 'loop', or 'if'

which is:
  unless this is any of: 'var', 'loop', or 'if'
or:
  if this is not all of: 'var', 'loop', and 'if'

But perhaps the thing to remember is to not mix negated operators with 
disjunctions?  The 'dis' being a form of negative and all.

I found this in E06:

  if %person{title} ne $known_title { ... }

Well... I guess E06 is unmaintained, but currently has the best 
explanation of junctions I can find, so I offer the attached patch in 
the hope that the logic error does not propagate.

--Eric
-- 
But you can never get 3n from n, ever, and if you think you can, please
email me the stock ticker of your company so I can short it.
--Joel Spolsky
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------
Index: exe/E06.pod
===================================================================
--- exe/E06.pod	(revision 14582)
+++ exe/E06.pod	(working copy)
@@ -857,6 +857,15 @@
         print "Unknown title: %person{title}.";
     }
 
+[Update: that was a logic error:  the negated operator carries through
+the disjunction and is always false.
+
+    unless %person<title> eq $known_title {
+        say "Unknown title: %person<title>.";
+    }
+
+Hash key quoting has also changed.]
+
 or even C<Code> references:
 
     my &ideal := \&tall & \&dark & \&handsome;

Reply via email to