Private imports and Objects
Patrick Schluter
Patrick.Schluter at bbox.fr
Thu Nov 30 19:03:35 UTC 2017
On Thursday, 30 November 2017 at 06:44:43 UTC, Jonathan M Davis
wrote:
> Object exists primarily because D didn't originally have
> templates, and when you don't have templates, having a single
> base class is the only way to have a function accept any class,
> and for something like a container, you'd pretty much be forced
> to use void* without Object if you don't have templates.
> However, once templates were added to D, the benefits of Object
> were significantly reduced, and it's arguably not a
> particularly good idea to be writing code that operates on
> Object. However, it's far too late in the game to get rid of
> Object.
And they come in very handy when one ports code from Java. As a
first approach a simple 1 to 1 adaptation of the code makes the
porting so much easier. Templates and D magic can come afterwards.
More information about the Digitalmars-d-learn
mailing list