Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Data structures != Types

Dynamic languages are not an argument to make bad use of data structures in any way, it changes nothing.



I think you missed my point. I wasn't arguing against bad use of data structures; just for a formalized, checked description of the data structures used in the program.

I have in the past written preprocessors for this purpose. A simple language just to describe the types used in the program, with the output being the implementation language's definition of the type, as necessary. I've even done it in Javascript, in a very roundabout way - was JScript.net, producing XML, which was consumed at runtime to create classes dynamically, which in turn were used by a dynamic programming language.

I'll go a long way to get a simple up-front map of the program's data in a checked format.


I totally get what you are saying. I also have the difficulty that when programming in Clojure and starting on a new problem, there is no really good way of writing down the data structure. I still love the flexibility of Clojure, though, so now I am trying to work around this by writing down proper documentation of the data structure instead of representing them exclusively with types.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: