Carmack about static analysis
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Thu Feb 9 12:22:52 PST 2012
On 24/12/2011 23:27, Adam D. Ruppe wrote:
> On Saturday, 24 December 2011 at 23:12:27 UTC, bearophile wrote:
>> I was talking about the abundance of (({}){()}) and not about
>> identifiers length.
>
> It's the same fallacy. I can't read Carmack's mind, but
> I'm sure he's talking about shortening code the same way
> I would mean it if I said it - simpler concepts, fewer cases,
> less repetition.
>
> It's about how much you have to think about, now how much you
> have to read/write.
Exactly.
Reminds me of the issues that some people have with Java
closures/lambdas. You do closures/lambdas in Java by means of creating
an anonymous class and then implementing a method, and this is much more
verbose than a plain lambda syntax, like D has (or many other functional
languages). But although it is much more verbose, it is actually not
that much more complex, it doesn't add much more to think about.
There is however another issue with Java's closures/lambdas which is not
complained or mentioned as much as the above, but is actually much more
annoying because it adds more semantic complexity: the closure can't
modify (the immediate/head value of) the outer variables. So when
modifying is necessary, you often see code where people instantiate a
one element array, the closure accesses the array (the array reference
is not modified), it then modifies the element inside, in index 0, and
then that is retrieved by the outer code when the closure finishes. This
on the other is a much more serious issue, and adds more complexity to
the code beyond just verbosity.
--
Bruno Medeiros - Software Engineer
More information about the Digitalmars-d
mailing list