Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Feature request: a new warning option



On Wed, 9 Oct 2019 at 15:25, Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
>
> Hmm... that's fair enough, but if you're happy to trade off against
> readability I think you have to take possible difficulties with the
> syntax on the chin...

I thought that:

[[ -z $ver ]] && ver="unknown (no .git/refs/heads/master)" || ver=${ver[1,7]}

is more or equally readable to:

if [[ -z $ver ]]; then
    ver="unknown (no .git/refs/heads/master)"
else
    ver=${ver[1,7]}
fi

especially if I would format it like I would today:

[[ -z $ver ]] && \
    ver="unknown (no .git/refs/heads/master)" || \
    ver=${ver[1,7]}

but I'm seeing your point. This is like commenting or not the code – I
was for a long long time pro-commenting, to just drop it recently,
actually finding pleasure in writing a condensed, I could agree –
(less /un)readable code.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



Messages sorted by: Reverse Date, Date, Thread, Author