News for hackers. Stuff that matters.
Re:Scala Considered Harmful For Large Projects? by rayiner on Thursday February 17, 2011 @07:40PM (#2233630)
The author's argument is specious. You need design guidelines in place for any language feature. You can say the same thing about interfaces in Java - you see a call x.doFoo() and you have no idea what code gets called! Well yes, that's why you formalize your module interfaces and don't let people just randomly create interfaces between modules, etc, etc.

Even in assembly you can define a function _do_foo that actually does "bar."

You need to know how to architect code with meta-programming in mind, no doubt. But this isn't any harder than architecting code with any other language feature in mind. Just as you need to clearly specify the semantics of your interfaces, you need to clearly specify the semantics of DSLs.

Managed properly, DSL's can have a tremendous positive impact on the code-base.

I've been mucking around in compilers lately, and one thing that never ceases to amaze me is SBCL. The compiler is about 55K LOC + 15K LOC for each native back-end. That's about the same size as the C1 compiler in Hotspot, but does a whole lot more (ie: includes the front-end of the compiler, while C1 gets low-level bytecode as input, has to deal with type inferencing and lambda lifting and all sorts of other things to bring a high-level dynamic language down to machine code, etc, etc). And it does that with algorithms about 15 years older (it doesn't have the benefit of SSA form which would massively simplify many of the optimizations SBCL performs).

Macros are a huge part of how SBCL does it. There are 123 macro definitions in the compiler, and they do a tremendous job in cutting code by making DSLs for things like specifying code generators, etc. As for readability - because it's well designed and well-commented, it's surprisingly maintainable and readable for a code-base that's 25 years old and has been maintained by so many different people over the years.

There are no comments on this comment yet.