lua-users home
lua-l archive

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


Steve Donovan wrote:

An interesting perspective from Robert C. Martin:

http://www.artima.com/weblogs/viewpost.jsp?thread=4639

In a nutshell: we need strong testing, not strong typing.
Bruce Eckel seems to have come to that conclusion:

http://mindview.net/WebLog/log-0025

Yes, I've noticed these trends in programmers' attitude too...

Now that's a cool idea.  Every function carries its own documentation.

Yes, why not use the function's descriptor both as user documentation
and as a C-style prototype? Both are descriptions of some kind, the
second is simply more formal :)
And since the power of Lua is in the ease of creating meta-data, making
such an all-purpose value descriptor is easy.

Absolutely.  It's true that dynamically typed languages are strongly
typed,
but a Pascal person would miss the ability to say that an integer was
only valid for 1 to 10, or that an array was not valid outside a
range.
But surely standard Lua tricks could be used to enforce this kind
of more precise run-time typing?

Well, for the simple case of an integer value that's only valid for 1 to
10, a Pascal person would probably create a new range type or an
enumeration. But there are many other cases when you need to add some
restrictions on a value, or describe some if its properties. The
simplest example is that you can't create ranged types for floating
point values in Pascal...

From my experience with writing plug-ins for 3D Studio MAX, I've
noticed the enormous need for detailed description of any parameter. The
3ds MAX SDK reflected that need by replacing the original built-in
parameter system with a new one at major release 3. The amount of
additional information that a parameter can require is surprising. At
the moment, MAX's parameter system carries tons of information about a
parameter - its type, readable name, range or allowed values, validator
function, some fixed id for persistency, different kinds of flags, GUI
information - just to name a few. As a consequence, the built-in
scripting language uses all this information to automatically expose all
the parameters of plug-in classes to the scripting system. So the
plug-in developer gets scripting support just by creating the proper
descriptors of his plug-in parameters.

As I mentioned, Lua shines when it comes to data description, so such a
descriptor system would be much easier to implement and would look much
nicer in Lua...

Since I consider most of my Lua work as public, I can give CVS access if
anyone is interested. So far I've started working on the descriptor
system, a testing system (with coverage), an OOP system (using the
descriptors), and all of these use a few general tools (like a "load
anything" loadModule function). And the most developed module is an
automated build system in the spirit of FinalBuilder, which I now use in
most of my projects.

Regards,
Ivan