On 11/12/13 4:36 PM, deadalnix wrote:
On Tuesday, 12 November 2013 at 22:45:15 UTC, Andrei Alexandrescu wrote:
What are the better ways? Note that most of the time you don't "know"
the name of a class - you get it down the wire during some
deserialization. So there must be some way to build an object from a
token representation of the object.


The serialization is a good example. You'll have to note that if the
code has been able to serialize the data, it can generate at compile
time the necessary scafolding to deserialize it.

I think there is some confusion here. We're talking about polymorphic creation, i.e. an object comes down the wire and you don't know its type a priori. Again: grab MC++D and read the chapter on Factory, it clarifies all such stuff.

It's not quite trivial - somewhere there has to be a map and
registration and lookup and whatnot. I don't see it why it's
unbecoming for such functionality to be part of the standard library.
I would agree, however, that it's a judgment call whether it should be
wired in or provided on demand.


That s why this is a problem to add all that is the core of the language
when it isn't used often.

That's a good point. I would tend to agree with that. But it doesn't make it a misfeature. It's a sensible feature.


Andrei

Reply via email to