Hacker News new | ask | show | jobs
by eldavido 4108 days ago
Ruby/Scala: Keep the language small, "Let our community enhance/extend the language" by writing DSLs (this, Rails, Chef), even at the expense of consistency

Python: Consistency trumps all, ship a large, complete stdlib, make programs easy to read because everything you need is included, and everyone does things more or less the same

Python's way provides better readability, but at the expense of power, IMO.

Thanks for posting, I have a friend who works at Zen Payroll and we were talking about whehter something like this could work well for modeling the tax code.

Also sidenote, Martin Fowler's book on DSLs is pretty decent, check it out.

1 comments

Thank you! I agree with you with regard to the fact that every DSL is a language "per se" that needs to be learned and so it amplifies a language syntax weight but, in general, IMHO a static language "readability" is better than a dynamic one's.

Since Python is a dynamically typed language its function signatures do not say much. Take, for example, the following Python definition:

def append(xs, x): ...

By reading this function signature you can't say anything about it. What are the parameter types? What does it return? Or, does it actually return anything at all? Same reasoning about Ruby being itself dynamic as well.

Now consider the same example in Scala:

def append[T](xs: List[T], x: T): List[T] = ...

Just by reading the signature you can say many things, such as this method takes a list of some type T and a value of type T and returns a list of type T.

I'm not dissing dynamically typed languages here. I understand there are situations where a dynamic language may be the best choice. What I'm saying is that when it comes to "readability" a static language wins over a dynamic one in terms of pieces of information given just by reading function signatures.

I've already read Martin's book and found it brilliant. Thank you for the hint anyway.

Cheers