{"action":"created","issue":{"url":"https://api.github.com/repos/albertodemichelis/squirrel/issues/34","repository_url":"https://api.github.com/repos/albertodemichelis/squirrel","labels_url":"https://api.github.com/repos/albertodemichelis/squirrel/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/albertodemichelis/squirrel/issues/34/comments","events_url":"https://api.github.com/repos/albertodemichelis/squirrel/issues/34/events","html_url":"https://github.com/albertodemichelis/squirrel/issues/34","id":148905252,"number":34,"title":"feature idea: object initialization","user":{"login":"zeromus","id":102701,"avatar_url":"https://avatars.githubusercontent.com/u/102701?v=3","gravatar_id":"","url":"https://api.github.com/users/zeromus","html_url":"https://github.com/zeromus","followers_url":"https://api.github.com/users/zeromus/followers","following_url":"https://api.github.com/users/zeromus/following{/other_user}","gists_url":"https://api.github.com/users/zeromus/gists{/gist_id}","starred_url":"https://api.github.com/users/zeromus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeromus/subscriptions","organizations_url":"https://api.github.com/users/zeromus/orgs","repos_url":"https://api.github.com/users/zeromus/repos","events_url":"https://api.github.com/users/zeromus/events{/privacy}","received_events_url":"https://api.github.com/users/zeromus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-17T00:28:50Z","updated_at":"2016-05-18T16:58:20Z","closed_at":null,"body":"This is a speculative idea. I haven't thought it through completely.\r\n\r\nI would like to see a functionality like struct or object initialization (I think that's what it's called.) Essentially an instance would have a {} operator which would let you set values on it as in table creation.\r\n\r\nFor example:\r\n\r\n\t\tlocal myinst = MyClass() { X=1,Y=2 };\r\n\t\t//as a possibly unfortunate side effect, this is oddity might be allowed:\r\n\t\tmyinst { X=3 };\r\n\r\nHere, you could view a `{` at this point in the grammar as a `.setvalues( {` method which takes a table, but naturally we'd want to avoid the overhead of creating a new table just to immediately stuff the values in another instance.\r\n\r\nAll of the above could be applied to tables as well, sensibly, but you would probably want to support { X=1,Foo<-2 } in that case, and you can no longer conceptualize it as a `.setvalues( {`. Moreover, it's just plain weird to do this on tables. But I could see someone defending it as useful.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/albertodemichelis/squirrel/issues/comments/220091171","html_url":"https://github.com/albertodemichelis/squirrel/issues/34#issuecomment-220091171","issue_url":"https://api.github.com/repos/albertodemichelis/squirrel/issues/34","id":220091171,"user":{"login":"albertodemichelis","id":8388649,"avatar_url":"https://avatars.githubusercontent.com/u/8388649?v=3","gravatar_id":"","url":"https://api.github.com/users/albertodemichelis","html_url":"https://github.com/albertodemichelis","followers_url":"https://api.github.com/users/albertodemichelis/followers","following_url":"https://api.github.com/users/albertodemichelis/following{/other_user}","gists_url":"https://api.github.com/users/albertodemichelis/gists{/gist_id}","starred_url":"https://api.github.com/users/albertodemichelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertodemichelis/subscriptions","organizations_url":"https://api.github.com/users/albertodemichelis/orgs","repos_url":"https://api.github.com/users/albertodemichelis/repos","events_url":"https://api.github.com/users/albertodemichelis/events{/privacy}","received_events_url":"https://api.github.com/users/albertodemichelis/received_events","type":"User","site_admin":false},"created_at":"2016-05-18T16:58:20Z","updated_at":"2016-05-18T16:58:20Z","body":"Well, this might be a change for a major release(4.0) I'm quite sure this would break a lot of stuff in our codebase. Often ppl omit the comma when declaring tables with a newline between fields. I don't have strong feelings about it. It never seemed to cause problems in the last 13 year. FYI, also arrays and function calls have optional commas :scream_cat: ."}}