Confession: My name is Lars Fosdal, and I am a writer of frameworks.

Confession: My name is Lars Fosdal, and I am a writer of frameworks.

It’s just so hard not to do it!. I really dislike cut & paste code or having to rewrite the same code with just different types!  Generics are really addictive, and I fear I have become a user. 

22 thoughts on “Confession: My name is Lars Fosdal, and I am a writer of frameworks.


  1. And I fear you might also be infected with the overgenerification syndrome. When I see people making half the class hierarchy generic just because they pass in some class as generic parameter somewhere (which would have worked just fine with passing a TClass) it drives me crazy.


  2. “I really dislike cut & paste code or having to


    rewrite the same code with just different types! ”


    Just look into a mirror, say “dynamic typing is superior to static typing” and a weight will be lifted from your shoulders! 🙂


    Delphi’s type system (along with C, Java, etc.) is rather “old school”. Type theory has advanced so far that I know functional language programmers who don’t even consider languages like Java to have “real” static typing. 🙂 Heck, F# lets you create types with units so you don’t inadvertently add kilograms and meters despite both being integers or floats! 


    Ceylon isn’t functional but uses union and intersection types so variables can have multiple types while still preserving static typing!


    https://en.wikipedia.org/wiki/Ceylon_(programming_language)#Type_System


    With Ceylon it’s trivially possible to do something I didn’t think would be possible to do in a statically typed language – create a dictionary that allows different types for the values! 


    All that said, dynamic typing gives you generics “for free”, which is nicest of all. 


  3. It is static vs dynamic typing (compile time or runtime) and it is strict vs weak typing (how stricly are types distinguished).


    See: http://stackoverflow.com/a/2351203/587106 or for more reading https://en.wikipedia.org/wiki/Type_system


    And also when some languages don’t require explicitly stating a type for a variable that does not make anything dynamic. It just means their compiler is not completely retarded and can infer the type from the assignment and then declares this variable as of this type. Any subsequent assignments to it with a wrong type will result in a compile time error!


    Which is why it is my personal opinion that the need to predefine variables in Delphi is really archaic and does not lead to any better code than in languages where you can declare them inline as needed.


  4. Stefan Glienke I would not mind inline declaration and limited scope for sure. Type inference would be good too, but I still would like the option to be explicit if needed, both scopewise and typewise.