all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Milan Zimmermann <milan.zimmermann@gmail.com>
To: 59612@debbugs.gnu.org
Subject: bug#59612: A comment line in example change
Date: Sat, 26 Nov 2022 10:59:13 -0500	[thread overview]
Message-ID: <CAEc2VK3OM8CQ3ry3zCHLh4YKb-2XvmVUNhaa+-jjJH30dnXOCA@mail.gmail.com> (raw)
In-Reply-To: <CAEc2VK1jY+e4Vt1HFRxxeW-AehSqYTWJNd=g2S99FBqPgx=Y8g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

The script I provided has a mis-typed comment on line 6. The script should
be:

################################################################
# The behavior of conditionals depends on whitespace
# Source this script to test it

# This formatting works as expected; evaluates the "true" block.
# Result:
#  "It is 2" # <=== The original had a typo here, included NOT
#

if { = 2 2 } {
  echo "It is 2"
} {
   echo "It is NOT 2"
}

# This formatting causes a BUG: both the "true" block and the "false" block
are evaluated.
# I tried several combinations, it appears it the "false" block starts on
it's own line,
# it is no longer treated a part of the "if" expression. Which could be
argued
# is expected because there is no "else" that would define whether the
second block
# is not part of the "if" expression. BUT see next test
#
# Result:
#  "It is 3"
#  "It is NOT 3"
#

if { = 3 3 } {
   echo "It is 3"
}
{
   echo "It is NOT 3"
}

# BUT we get the same incorrect result if we place the whole if expression
into {}
{
  if { = 4 4 } {
     echo "It is 4"
  }
  {
     echo "It is NOT 4"
  }
}
######################################################################

[-- Attachment #2: Type: text/html, Size: 1672 bytes --]

  reply	other threads:[~2022-11-26 15:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26 15:52 bug#59612: 29.0.50; Eshell: The behavior of conditionals depends on whitespace Milan Zimmermann
2022-11-26 15:59 ` Milan Zimmermann [this message]
2022-11-26 16:19 ` bug#59612: Incorrect behavior also with ${CONDITION} Milan Zimmermann
2022-11-26 18:28   ` Jim Porter
2022-11-26 19:32     ` Jim Porter
2022-11-26 18:42 ` bug#59612: 29.0.50; Eshell: The behavior of conditionals depends on whitespace Jim Porter
2022-11-27  0:39   ` Jim Porter
2022-11-27  2:16   ` Milan Zimmermann
2022-11-27  3:13     ` Jim Porter
2022-11-27  5:07       ` Milan Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEc2VK3OM8CQ3ry3zCHLh4YKb-2XvmVUNhaa+-jjJH30dnXOCA@mail.gmail.com \
    --to=milan.zimmermann@gmail.com \
    --cc=59612@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.