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 Coroutines once stated:

  [ snip a bit about using the text editor to expand into Lua code ]

> Yes, in that vein I always preferred looking at post-processed C programs
> (cc -S).  I swear people here are crazy about avoiding convenience and
> concision.  Python's import() statements cause confusion to no-one who
> reads documentation on what a library provides.  If you don't recognize a
> stock global identifier it must be coming from somewhere ~  Whatever, we've
> had this discussion before -- Lua is just anti-convenience because everyone
> on this list is a feature-Nazi.  I cannot tell you how much those 20+ lines
> of local declarations bother me to skim -- and I have seen much larger,
> unmaintainable lists of declarations in the wild.

  What bothers me are people that go "this feature needs to be implemented,
because it's cool/saves typing/this other language does it this way" and
then, don't bother to even try implementing the feature.  You have the
source code to Lua.  It's not very much code either.  

  Okay, a valid complaint---"why should I have to know C to get this?"  But
you know what?  You can prototype the actions in Lua, even if it's to run
the code through some Lua code to do the expansion/munging/whathaveyou to
massage "import math" into what you want done.  You know, proof-of-concept,
work out details and what not.

  Now, my impression is that a statment like

	import "math"

creates all the entries in the math module as locals (thus, the code
presented), all to avoid (in my opinion) some typing.  My concern about such
a method---too many "imports" and you run out of locals!  The limit for Lua
5.1, 5.2 and LuaJIT is 200 locals per scope (I haven't tried Lua 5.3).  And
it's not a simple change of the codebase to increase the number of locals.

  Which is why I think doing work to get what you want, however you want, as
a "proof-of-concept" is important.  It gives people something to work with,
to try out (much like Roberto & Co. is doing with Lua 5.3) and possibly even
break with stupid ideas like including 200 modules into a single code base
[1].  It could also lead to other questions, such as, "why only into locals? 
What if I want some of the imports to be global?"  

  -spc (And 20 lines of local declarations don't bother me, but then again,
	I cut my teeth in Assembly lanuage, where you were limited to one
	line per variable ... )

[1]	Who would do such a thing?  Heck, who would make a Lua script 32M in
	size? [2]

[2]	Me.  Found this bug in Lua 5.1 when trying to run a 32M Lua script:
	http://www.lua.org/bugs.html#5.1.4-6