lua-users home
lua-l archive

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




On Tue, Oct 23, 2012 at 3:29 AM, spir <denis.spir@gmail.com> wrote:
I noticed the following: after programming for a long time only in dynamic languages, when I then switch to static typing, for a while I have about no type error (at compile-time, indeed); then they start to happen, and finally I have many. I think, maybe, after some time we start "programming-thinking" differently. Dynamic programmers may have a clearer awareness about types --that is, ultimately, the meaning of symbols-- and unconsciously pay more attention to their coherence in the model. Conversely, after some time, static programmers may start to rely on the machine to do this job; and it does it well, provided your typing is correct and clear. They become so-to-say lazy about that, not uselessly spending their "neuronic power" in what a machine can do (better).
Both are good, in my opinion.



I have noticed the same thing. As background, I'd classify myself as a hacker. In my software company, I don't program for my job.

Whenever I program in Lua, I find myself setting up a quick argument checker for the group of functions that cover a particular area of a program that I'm writing. At first, it usually just checks for what is required, applies defaults to what isn't there and gives awesome errors (written like a manual) when it gets non-sense.

I was speaking with a developer about an error they had found in a shipping product. It struck me that they didn't check for this particular lexical error on one of the interfaces for an object's method. It was really alarming, given that the input came from a serial port.

Now, notwithstanding the recklessness of that oversight, it got me thinking about the nature of dynamic languages and how their cultures differ from each other and from those of static languages.

Prior to Ruby taking off, pretty much every dynamic language that I've been around had people that didn't go to school to learn to program as their target audience. Ruby's mission was "programmer happiness" and was picked up by a crowd that at least professed to strive for quality code. Ruby's testing culture boarders on nauseating.

An analogy might be the difference between a raw performance car (say an older Porche 911), and a modern, high-tech version of the same (Skyline / GTR, with all of its tele-metrics and four wheel drive).

An average driver will be much faster in the GTR, using all of the help that the advanced technology provides (type checking, syntax highlighting).

A great driver will be much faster in the 911, because the car is lighter and doesn't interfere when it shouldn't. 

I think that there is a sense of false security that people _can_ gain from all of the bells and whistles that an IDE can provide and that type checking provide. They are great, no doubt, but maybe arguments should always be checked, both for type and for sanity? Maybe type checking is just a really primitive and inflexible way of doing something that might be done more clearly and more completely, when the program is being designed?

I've never missed type checking in lua.

On a related note, I really wish that nil was not false, although I know I'm in the minority on that one. :)

-Andrew Starks