On 02/02/2012 11:00 AM, xancorreu wrote:
> Al 02/02/12 19:18, En/na bearophile ha escrit:

> Can I say "serialize the first, second and third arguments as Class
> Person"?
>
> I mean, if you define a class Person like:
>
> class Person {
> string name
> uint age
> dead bool
> }
>
> could you serialize the input from console, like
> Std.in.serialize(Person, args(0), args(1), args(2))?

I haven't used it but there is Orange:

  https://github.com/jacob-carlborg/orange

I think it will be included in Phobos.

> You could do that "manually" checking each paramm, but it's a tedious task.

If the input is exactly in the format that a library like Orange expects, then it's easy.

To me, constructing an object from user input is conceptually outside of OO, because there is no object at that point yet. It makes sense to me to read the input and then make an object from the input.

Depending on the design, the input may be rejected by the function that reads the input, by the constructor of the type, or by both.

> Thanks,
> Xan.

Ali

Reply via email to