3 ms·
> In practice, annotations define runtime global variables that other frameworks can make use of by doing expensive classpath scanning on startup to rewrite byt
by agentgt 10y ago
> In practice, annotations define runtime global variables that other frameworks can make use of by doing expensive classpath scanning on startup to rewrite bytecode at runtime.
Dagger2 is DI a compile time annotation library. Yes there needs to be a lot more libraries like this.
I totally understand some of your hate for annotations (I have my own with Spring Boot).
Despite my tone from the previous comment I think there should be a lot more plain old programmatic configuration (ie just load up objects and setup some properties during the bootstrap).
I had aspirations of making a howto guide using Dagger2 and various other compile time / code generation libraries (like jOOQ and MapStruct) as I too absolutely hate the classpath scanning hell that is Spring these days.
I can't deny though that some people find the "magic" more productive particularly for ramp up time.
All in all I violently agree with you more than you think (hence why I'm looking forward to your post).
I still don't know what a dynamic language is and neither does Wikipedia for that matter [1]. Its pretty nebulous. Its like saying strongly typed.
[1]: https://en.wikipedia.org/wiki/Dynamic_programming_language#Examples https://en.wikipedia.org/wiki/Dynamic_programming_language#E...
- NiceGuy_Ty 10y agoDynamically typed languages carry the types of values at runtime. That is, whatever is executing your code can look at a value itself and read off the type of it. Statically typed languages check all of the types of their values at compile time to make sure that it's sound. Then, they can strip the type information from those values and execute them without having to perform any runtime checks. In a dynamically typed language, the way to apply an operation is to read the type tag on it first, make sure the operation you want to apply can be applied to it, and then execute that operation. In a statically typed language, that check happened at compile time, so you're safe to just apply the operation to the value. Oftentimes languages may not be fully statically typed or fully dynamically typed. Java's use of reflection, instanceof, and casting means that it carries some type information at runtime. C++ has typid, C# has GetType(), etc. etc. Haskell as a language has full type erasure and can be considered fully statically typed, but there are some. GHC extensions (Typeable) which point to some type information being held at runtime by the compiler.