John Nilsson | 24 Dec 13:30
Picon

Re: Scala Object Notation ( SCON? )

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


Gmane