24 Dec 13:30
Re: Scala Object Notation ( SCON? )
John Nilsson <john <at> milsson.nu>
2007-12-24 12:30:57 GMT
2007-12-24 12:30:57 GMT
On Mon, 2007-12-24 at 11:47 +0000, Jon Pretty wrote:
> Hi John,
>
> And how about this?
>
> type Person = {
> def name : String
> def age : Int
> }
>
> val person = new {
> def name = "Peter"
> def age = 20
> } // this is a Person
This doesn't fit with the requirement of instantiating a Person (type
Person isn't quite the same is it?) without creating a new subclass per
instance dose it?
> So many options, but none of them quite as concise as JSON...
If you skip the type declaration I'd say it's close enough.
Best Regards,
John
RSS Feed