zsh-workers
 help / color / mirror / code / Atom feed
From: Greg Klanderman <gak@klanderman.net>
To: zsh-workers@sunsite.dk
Subject: Re: bug in ztrftime(): '%e' and '%f' specifiers swapped
Date: Fri, 26 Jun 2009 17:57:38 -0400	[thread overview]
Message-ID: <m31vp61wvh.fsf@klanderman.net> (raw)
In-Reply-To: <200906262123.n5QLNqJU008820@pws-pc.ntlworld.com> (Peter Stephenson's message of "Fri, 26 Jun 2009 22:23:52 +0100")


> Interesting how subjective this is, I find it significantly less so

Yep!  Not to try to sway you, but I'll give you my reasons just for
the fun of it..

I guess the biggest is that I really don't like cases that do
something then fall through, it's just very hard to reason about, and
usually makes further modifications difficult and error prone.

Also, this style very rarely is able to extend beyond two cases - case
in point when you added the 'H' format you had to violate your first
three points below.

> - there is no immediate visual cue that the formats do different things

I would always assume if there are multiple cases sharing the same
logic that the logic itself will differentiate between them, not that
they all function identically.

> - the test for the format letter is repeated without it being obvious it
>   is the same test
> - it's made even less obvious because the second test has to advance
>   back down the format string since the key letter isn't saved in a
>   variable [we do this sort of thing all the time elsewhere, though]

I certainly would have saved the switch'd on character in a variable
if I were writing this, and probably if I'd had a working build system
I might have done more significant cleanup.  On the other hand, when
submitting patches to a project like this I usually go for the minimal
change because otherwise it's a larger burden on whoever reviews and
commits the change.  Seeing that pattern (fmt[-1] == 'x') already in
use in that function I figured it was considered not so bad.

> - the fact that 'f' sets the "strip" feature unconditionally is obscured

strip = strip || (fmtchar == 'f') is pretty clear to me :-)

> - I'm not that keen on "||" and "&&" in assignments anyway [again, the
>   shell is full of stuff I'm not that keen on]

> so I've committed the first one.

thank you!

greg


  reply	other threads:[~2009-06-26 21:58 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <gak@klanderman.net>
2009-06-26 20:40 ` Greg Klanderman
2009-06-26 21:23   ` Peter Stephenson
2009-06-26 21:57     ` Greg Klanderman [this message]
2010-02-05 17:01 have '&' automatically disown? Greg Klanderman
2010-02-05 17:33 ` Peter Stephenson
2010-02-05 17:36   ` Peter Stephenson
2010-02-06  3:26     ` Greg Klanderman
2010-02-07 18:20       ` Peter Stephenson
2010-02-07 21:06         ` Greg Klanderman
2010-02-07 21:34           ` Peter Stephenson
2010-02-07 22:36             ` Bart Schaefer
2010-09-02 14:57               ` Greg Klanderman
2010-09-05 19:11                 ` Bart Schaefer
2010-09-06  1:50                   ` Greg Klanderman
2010-02-07 21:59           ` Mikael Magnusson
  -- strict thread matches above, loose matches on Subject: below --
2009-05-17  4:55 PATCH: make PROMPT_SP end-of-line marker configurable Greg Klanderman
2009-05-17 17:27 ` Peter Stephenson
2009-05-17 18:04   ` Greg Klanderman
2009-05-17 19:23     ` Peter Stephenson
2009-05-18  1:00       ` Greg Klanderman
2009-05-18 18:27       ` Greg Klanderman
2009-01-13  7:32 treatment of empty strings - why is this not a bug? Greg Klanderman
2009-01-13 19:24 ` Peter Stephenson
2009-01-13 22:08   ` Peter Stephenson
2009-01-15 20:11     ` Greg Klanderman
2009-01-15 20:29       ` Peter Stephenson
2009-01-16 10:02         ` Peter Stephenson
2009-01-15 20:28     ` Greg Klanderman
2009-01-15 20:34       ` Peter Stephenson
2009-01-16  4:19 ` Bart Schaefer
2009-01-16 17:35   ` Greg Klanderman
2009-01-16 17:55     ` Peter Stephenson
2009-01-16 19:40       ` Greg Klanderman
2009-01-16 23:26         ` Richard Hartmann
2009-01-17  3:45         ` Bart Schaefer
2009-01-17  3:35     ` Bart Schaefer
2009-01-17  5:31       ` Greg Klanderman
2009-01-17 17:53         ` Peter Stephenson

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=m31vp61wvh.fsf@klanderman.net \
    --to=gak@klanderman.net \
    --cc=zsh-workers@sunsite.dk \
    /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 public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).