lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Sir Pogsalot once stated:
> Sven (and subsequently Sean):
> 
> I get a sense from what you've written in previous postings that you (and
> Sean) are strongly against feature creep.  I mean there are postings on
> lua-l all the time about people wanting to add `x' to Lua and hoping
> upstream or enough of the community will agree (like here).  

  PHP: the poster child for feature creep in a language.  

  See also, C++

> I would
> understand if it's easy to get into the habit of discouraging every
> proposal simply because you want to protect a minimal core (I do love that
> core <3).  There are a lot of good ideas out there, a lot of fun things
> that could be added, but it's tricky to decide which are worth supporting
> for the most benefit to everybody.  I imagine it's easier to just lock the
> door and turn out the lights -- so to speak.  I don't see this as a huge
> addition that would up heave the principles you revere in Lua.  It doesn't
> mess with or add to the grammar, it's not adding another standard library
> of functions, it would simply help cut down on the list of local reference
> ~noise~ that precedes and muddies most scripts.  You have at least 3 people
> telling you those lists are hard to quickly glance through for correctness.
> :>

  What you call "mud" I call "explicit clarity."  I don't call that noise.
This:

	local x_this = module.this
	local x_that = module.that
	local x_theother = module.theother

doesn't faze me, and in fact, makes it easier for me to locate the
definition of a variable than

	import_as_locals('module',{ 'this' , 'that' , 'theother' } , 'x_')

("Where *IS* that definition of x_theother anyway?  I can't locate it?")

  I also don't feel I'm missing anything from Lua.  Would I like a shorter
delcarations of anonymous functions?  Hell, I'm happy to *have* anonymous
functions and I can certainly deal with the "function() ... end" overhead; I
can type fast.  

  Or at the very least, I can bind some keystrokes to my editor to type out
the "function() end" for me if I wanted to.  

> I do find it amazing you and Sean would be this passionately against this
> -- it gave me a "dont be lazy" impression?  Maybe I'm lazy for not wanting
> to write 10-20 lines of local references (depending on the situation), I
> just see it as something that keeps people from scripting comfortably in
> Lua.  

  Perhaps it's that I'm not bothered with writing those lines.  Okay, the
module that has the largest preamble that I've written goes:

	local dump     = require "org.conman.table".dump
	local assert   = assert
	local print    = print
	local tostring = tostring
	local table    = table
	local math     = math
	local schedule = schedule
	local timeout  = timeout
	local run      = run
	local coroutine = coroutine
	
	local syslog = require "org.conman.syslog"
	local errno  = require "org.conman.errno"
	local stat   = require "stat"
	local net    = require "org.conman.net"
	local dns    = require "org.conman.dns"
	local sys    = require "org.conman.sys"
	local cc     = require "org.conman.cc"
	local lpeg   = require "lpeg"
	local util   = require "FOO.util"
	local ddt    = require "ddt"

	module("FOO.bar")

	local Cg = lpeg.Cg
	local Ct = lpeg.Ct
	local Cc = lpeg.Cc
	local Cs = lpeg.Cs
	local C  = lpeg.C
	local P  = lpeg.P
	local S  = lpeg.S

  And frankly, I didn't write that all in at once, but slowly, as I wrote
the module (446 lines of Lua code).  And the proposal you want would have
realy only saved me, at most, 7 lines of code (pulling functions out of
lpeg).  Don't let all the "org.conman" modules fool you---they're all
standalone modules and the only reason they're under "org.conman" is for
namespacing reasons.

  And it's not like I don't write modules all that much---there are at least
30 modules I've written under the "org.conman" namespace [2].

  Hmm ... perhaps it does seem I'm saying "don't be lazy and type!"  But I
also have the view point of a maintainer, who has to look at this code in
perhaps a year (or several) and all that clevery stuff to avoid typing is
now getting in the say of understanding ... 

> We've all been in those situations where writing the module name
> before each function becomes tedious and we'd rather have a short local
> identifier to call upon.  My point: I don't stick around to use languages
> that don't save me time.  I've been proud to script in Lua over other
> languages for 3-4 years now because of its clarity, but I know for an
> absolute certainty that what I'm talking about is an eyesore and/or a
> tedious preamble to write for many others.  This could be better.

  Okay, let me ask you, what do you mean by "save you time?"  It certainly
can't be to save typing, otherwise, you'd be using APL.  I too, like using
Lua to save time, but for me, it's overall development type by giving me an
easy to use language, easy to use API, garbage collection, true anonymous
functions, closures, coroutines, LPeg (now THAT is a God send) and NO
#@@#$@# SIGILS ON VARIABLES! (that last one is very important to me)  Less
typing is not even on my radar.

  -spc (Okay, admittedly, about half my modules are written in C ... )

[1]	Our deal developer *hates* Linux, but I digress ... 

[2]	https://github.com/spc476/LPeg-Parsers	(4 modules)
	https://github.com/spc476/SPCDNS	(1 module)
	https://github.com/spc476/lua-conmanorg	(22 modules)
	https://github.com/spc476/SPCUUID	(1 module)
	https://github.com/spc476/ipacld	(1 module)

	Plus one or two I have yet to release.