Anti-OOP... stupid?

Timon Gehr timon.gehr at gmx.ch
Wed Feb 15 12:55:46 PST 2012


On 02/15/2012 09:17 PM, foobar wrote:
> On Wednesday, 15 February 2012 at 15:35:53 UTC, Timon Gehr wrote:
>> On 02/15/2012 03:30 PM, foobar wrote:
>>> ...
>>> 1. D templates are an enhanced version of C++ templates which are a poor
>>> design. The problem stems IMO not from issues with OOP but rather with
>>> the horrible idea of C++-like templates. Other languages have *much*
>>> better solutions which integrate better.
>>>
>>> [snip.]
>>
>> Please elaborate. What kind of construct in a language that supports
>> OO solves the same set of problems D templates do and is unequivocally
>> a better design?
>
> Lisp/scheme macros come to mind :)

=D. I actually thought about explicitly excluding those to get a more 
meaningful answer. Using runtime code modification is cheating.

There are certainly ways to dynamically dispatch, expand and execute a 
macro in lisp. If every D program was allowed to include a complete D 
compiler, virtual template functions would work too. Can you point me to 
an implementation in lisp that does this and is actually fast enough to 
be considered for real work?

> There are no issues AFAIK integrating
> those with OOP, in fact the OOP features are implemented with macros
> (CLOS).

You can use templates to implement a multiple-dispatch virtual function 
system just fine. We are not talking about implementing OOP using 
templates, but about using templated virtual methods.

Anyway, I don't see your point yet: You seem to think templates are 
poorly designed because dynamic languages such as lisp are more flexible 
than static languages such as D?


More information about the Digitalmars-d-learn mailing list