It is obvious there is the possibility to join these features in different ways. But one of the ways seems to me more promising. Namely: the static type part is used in the public API, and leave dynamic elements of the language in the "private" scope of modules* (classes, traits and the like).
Code would look like:
class UsersController
_userDao = UserDao.instance
String index(RequestParams params)
order = params.get 'order'
users = _userDao.order(order).all
format users
def format(users)
names = users.join ', '
This approach combines conciseness of dynamic languages with safety of static ones.
* not to be confused with the Hindley–Milner type inference algorithm
No comments:
Post a Comment