Skip to content

Comment on Dynamic Languages Are Static Languages (2011)parent

Comments

In the first case, any sane static language will use type inference, so you won't have to write out "int foo", just "let foo" or equivalent. (I'd also argue that any sane static language would disallow or at least heavily discourage mutable variables, but that's neither here nor here).

The second case is easily handled by static languages, for example, in Swift:

    var mydata = ["foo": Dictionary<String, MyObject>()]
    mydata["foo"]["bar"] = MyObject()
This is only longer than it needs to be because of using two lines, you wouldn't need the explicit declaration to do it in one:
    let mydata = ["foo": ["bar": MyObject()]]
This also gets rid of mutable state!
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.