dynamic classes and duck typing
Leandro Lucarella
llucax at gmail.com
Wed Dec 2 12:52:12 PST 2009
BCS, el 2 de diciembre a las 17:37 me escribiste:
> Hello Leandro,
>
>
> >If you say dynamic languages don't have metaprogramming capabilities,
> >you just don't have any idea of what a dynamic language really is.
> >
>
> If you say you can do metaprogramming at runtime you just don't have
> any idea of what I want to do with metaprogramming. For example:
What you say next, is not metaprogramming per se, they are performance
issues (that you resolve using compile-time metaprogramming). You're
missing the point.
> unit carrying types: check for unit errors (adding feet to seconds)
> at compile time. I can be sure there are no unit error without
> knowing if I've executed every possible code path.
There is no compile time metaprogrammin in dynamic languages, you just
can't verify anything at compile time, of course you can't do that!
Again, you are talking about performance issues, that's doable in
a dynamic languages, the checks are just runned at run time.
> Domain specific compile time optimizations: Evaluate a O(n^3)
> function so I can generate O(n) code rather than write O(n^2) code.
> If you do that at runtime, things get slower, not faster.
Again *optimization*. How many times should I say that I agree that D is
better than almost every dynamic languages if you need speed?
> Any language that doesn't have a "compile time" that is evaluated
> only once for all code and before the product ships, can't do these.
You are right, but if you *don't* need *speed*, you don't need all that
stuff, that's not metaprogramming to fix a "logic" problem, they are all
optimization tricks, if you don't need speed, you don't need optimization
tricks.
The kind of metaprogramming I'm talking about is, for example, generating
boring, repetitive boilerplate code.
--
Leandro Lucarella (AKA luca) http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Es mejor probar el sabor de sapo y darse cuenta que es feo,
antes que no hacerlo y creer que es una gran gomita de pera.
-- Dr Ricardo Vaporesso, Malta 1951
More information about the Digitalmars-d
mailing list