lua-users home
lua-l archive

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


On Tue, Jul 1, 2014 at 12:37 PM, Pierre Chapuis <catwell@archlinux.us> wrote:
> If we gave the same amount of time to two groups of
> programmers familiar with the two languages to accomplish
> the same task, I would expect:
>
> - the C code base to be larger in terms of LOC;
> - the C codebase to have more bugs;
> - the C codebase to have worse architecture.

i would expect the same, but not because of the language; it's because
the C standard libraries include only very low level concepts.  any
usable data structure has to be written on top of the language, and if
it's homegrown instead of reusing a good library, it quickly becomes a
big part of the maintenance problems.

> I think the same would be true of Java.

..... not really, because there _is_ a pretty reasonable standard
implementation of most of the basic structures.  the same with C++
(STL/Boost) and C#.


> Moreover I would say C code is, in practice,
> often typed more weakly than Lua code. For instance,
> every time you cast something to void* to use it as
> a callback argument, you lose its type, which is
> not the case in Lua. So in Lua you will have an
> error at runtime, but in C you may have no error
> at all...

that's just bad practice.  with discipline you can tuck the few
inevitable (void*) casts deep behind type-safe APIs.  In C++/Java/C#
it's almost mandated by any style guideline and not doing it raises
all types of warnings in the most trivial of static analyzers.

of course, it's the same disciplines that make dynamic languages
maintainable, but this only proves that it's not about the language,
but about the methods.


> Of course there are things that are better adapted
> to C and others to Lua, etc. More importantly, there
> are languages with much better type systems than C or
> Java (e.g. Haskell & friends) where I think those
> really make a difference in the large.

not the first time those are mentioned here.  does anybody know of a
big Haskel codebase?

-- 
Javier