3 ms·
Another one of those things you never have to worry about if you use a statically typed language.
by smrtinsert 13y ago
Another one of those things you never have to worry about if you use a statically typed language.
- TylerE 13y agoThat's actually not true. For instance, the game Alpha Centauri generated custom dynamic functions in RAM at runtime to draw user created units.
- ultimoo 13y agoThis is a great way of disagreeing with a position. Polite and backed by a concise fact. Thanks.
- patmcguire 13y agoHow do you know that? I'm not saying you're wrong, I'm just curious. Did you work on the game? Are you a hardcore modder?
- TylerE 13y ago"When I first came onboard with Loki, the Alpha Centauri Plantary Pack was my first porting project. I didn't know what to expect from commercial game code, but I sure wasn't expecting what I found in the SMAC codebase. Tens of thousands of lines of assembly code was in SMAC, some of which was self-modifying. I spent most of my time looking at memory in the debugger and flipping bits."
- islon 13y agoIn a statically typed language you have to worry about many other things tough =)
- abstractbill 13y agoThis has nothing to do with static vs dynamic typing. In Java, for example, you can easily invoke a method named by a string that's not defined at compile time (using the reflection api).
- iso-8859-1 13y agoBut since you can't define methods using reflection, I'd say this isn't used much and isn't really a problem in Java. Are you really having trouble decyphering a Java function relying on home-made dynamic dispatch? But yeah, I'd say it's more about http://en.wikipedia.org/wiki/Dynamic_dispatch http://en.wikipedia.org/wiki/Dynamic_dispatch than static/dynamic typing. You can have dynamic dispatch in a statically typed language. I don't know how OP would feel about virtual methods in C++ since he resists using an IDE.
- mbell 13y ago> But since you can't define methods using reflection, I'd say this isn't used much and isn't really a problem in Java. You can do about anything you want with cglib / Javassist. Dynamically subtyping or byte code re-writing a class is how many Java ORMs work.
- ZitchDog 13y agoCorrect. You can also use Dynamic Proxies, for metaprogramming, which are built right into the language.
- Peaker 13y agoThat's a dynamically typed sub-language within Java.
- Periodic 13y agoMacros still can cause a lot of problems. See some of the crazy C++ macros or Template Haskell.
- elwin 13y agoStatically typed languages also have worrisome features. #define readinto(obj, fd) (isatty(fd) ? readbuffered(obj, fd, findttystate()) : readfromfile(obj, fd))
- Peaker 13y agoCounterpoint: Macros. Though you could preprocess the code and grep that, it wouldn't work too well. Eclipse-et-al can give you a sort-of-works-most-of-the-time navigation features that work with the preprocessed code, which can overcome the macro problem, mostly.