From owner-svn-src-all@freebsd.org Mon Feb 26 04:55:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A7C2F2A6B8; Mon, 26 Feb 2018 04:55:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 086368293A; Mon, 26 Feb 2018 04:55:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F328F16E24; Mon, 26 Feb 2018 04:55:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1Q4t844072388; Mon, 26 Feb 2018 04:55:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1Q4t8tO072387; Mon, 26 Feb 2018 04:55:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802260455.w1Q4t8tO072387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 26 Feb 2018 04:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330012 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 330012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Feb 2018 04:55:09 -0000 Author: kevans Date: Mon Feb 26 04:55:08 2018 New Revision: 330012 URL: https://svnweb.freebsd.org/changeset/base/330012 Log: style.lua(9): Add some additional notes about naming and commas camelCase tends to be preferred for function identifiers, while internal_underscores are preferred for variable identifiers. This convention makes it a little bit easier to eyeball whether variable/function usage is correct. The optional commas for final table values are preferred to reduce chances for error. Modified: head/share/man/man9/style.lua.9 Modified: head/share/man/man9/style.lua.9 ============================================================================== --- head/share/man/man9/style.lua.9 Mon Feb 26 04:33:05 2018 (r330011) +++ head/share/man/man9/style.lua.9 Mon Feb 26 04:55:08 2018 (r330012) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 20, 2018 +.Dd February 25, 2018 .Dt STYLE.LUA 9 .Os .Sh NAME @@ -83,6 +83,30 @@ Single-line conditional statements and loops should be .Pp .Ic local variables should be preferred to global variables in module scope. +internal_underscores tend to be preferred for variable identifiers, while +camelCase tends to be preferred for function identifiers. +.Pp +If a table definition spans multiple lines, then the final value in the table +should include the optional terminating comma. +For example: +.Bd -literal +-- No terminating comma needed for trivial table definitions +local trivial_table = {1, 2, 3, 4} + +local complex_table = { + { + id = "foo", + func = foo_function, -- Trailing comma preferred + }, + { + id = "bar", + func = bar_function, + }, -- Trailing comma preferred +} +.Ed +.Pp +This reduces the chance for errors to be introduced when modifying more complex +tables. .Pp Multiple local variables should not be declared .Sy and