Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2018 23:57:04 +0000
From:      Alexander Nasonov <alnsn@yandex.ru>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Kyle Evans <kevans@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r329609 - head/stand/lua
Message-ID:  <20180219235704.GB24491@neva>
In-Reply-To: <1519079823.91697.30.camel@freebsd.org>
References:  <201802192229.w1JMTG9C082624@repo.freebsd.org> <1519079823.91697.30.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Ian Lepore wrote:
> On Mon, 2018-02-19 at 22:29 +0000, Kyle Evans wrote:
> > 
> > +???????????????????????-- Swap the first two menu entries
> > +???????????????????????menu_entries[1], menu_entries[2] = menu_entries[2],
> > +?????????????????????????? menu_entries[1];
> > ?
> 
> IMO, this is the sort of unreadable insanity that comes from having
> inflexible rules about line-wrapping which trump readability. ?The
> original code could be easily understood. ?The suggested replacement,?
> 
>     menu_entries[1], menu_entries[2] =
>     ? ? menu_entries[2], menu_entries[1]
> 
> Was also pretty readable, although not as much as it would be if it
> were all on one line. ?But splitting the line at the whitespace nearest
> to 80 columns just creates an unreadable mess for the insignificant
> virtue of following some arbitrary rule. ?(Which is why I very often
> ignore that rule and split lines at the point < 80 which makes the most
> sense for understanding the code, even if that means splitting at
> column 30.)

+1

Other possibilities are:

 - moving code to a helper function often removes extra indentation
 - shorter identifiers (e.g. as a side effect of moving code to a helper
   function)

		local function swap_1_2(t) t[1], t[2] = t[2], t[1] end

		swap_1_2(menu_entries)

  or 

		local function swap(t, i, j) t[i], t[j] = t[j], t[i] end

		swap(menu_entries, 1, 2)
-- 
Alex



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180219235704.GB24491>