dynamic classes and duck typing

Leandro Lucarella llucax at gmail.com
Wed Dec 2 13:59:09 PST 2009


Don, el  2 de diciembre a las 22:20 me escribiste:
> Leandro Lucarella wrote:
> >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).
> 
> They are metaprogramming tasks. Dynamic languages can do some
> metaprogramming tasks. They can't do those ones.

Because they make no sense, I really don't know how to put it. If you need
speed, you code in C/C++/D whatever. Its like saying that you can't fly
with a car and that's a problem. It's not, cars are not supposed to fly.
If you need to fly, go buy a plane or a helicopter. Of course is much
cooler to fly than to drive a car, but if you need to go just a couple of
miles, flying gets really annoying, and it would take you more time, money
and effort to do it than using your car.

> >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.
> 
> "you don't need speed" is a pretty glib statement. I think the

I don't know what that means...

> reality is that you don't care about constant factors in speed, even
> if they are large (say 200 times slower is OK). But bubble-sort is
> probably still not acceptable.

Bubble sort is perfeclty acceptable for, say, a 100 elements array.

> Metaprogramming can be used to reduce big-O complexity rather than
> just constant-factor improvement. Lumping that in with
> "optimisation" is highly misleading.

It always depends on the context, of course, but when doing programs that
deals with small data sets and are mostly IO bounded, you *really* can
care less about performance and big-O.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
"CIRILO" Y "SIRACUSA" DE "SEÑORITA MAESTRA": UNO MUERTO Y OTRO PRESO
	-- Crónica TV



More information about the Digitalmars-d mailing list