Hi:
[Richard and James on CC]
Richard and James started to look into getting object literals to work in SOMns and that lead to some discussions about how they can work.
The first issue Richard noticed is that the object literal grammar isn't straight forward to implement in my recursive descent parser.
Since you guys use quite a different style of parser, I suppose the object literal syntax isn't problematic?
The spec in 5.1.10 says the grammar should be:
`objectLiteral = (identifier, keywordMsg opt) opt, classBody.`
I assume that objectLiteral is legal in place of any primary expression:
`primary = unarySelector |
literal |
block |
parenthesizedExpression.`
In the recursive descent parser, we got the challenge that the grammar requires unlimited look-a-head to work, if I am not mistaken.
Specifically, the issue is with the `keywordMsg` for the superclass constructor/factory method and the ambiguity between a `parenthesizedExpression` expression and `classHeader`, which is part of `classBody`.
Any ideas or suggestions of how that could be resolved would be welcome.
At the moment, it seems to me that support that syntax would require quite extensive changes to the SOMns parser. But, perhaps I am missing something.
The next issue that came up is instantiation semantics of the object literal class.
I would assume that each instantiation of an object literal also creates a separate class.
Is that how it is intended to be?
So, assuming we have something like `Array new: 1000 withAll: [ Object ()() ]`, this would create an array with 1000 fresh objects, and each having a separate class.
I believe this is necessary to preserve isolation between actors. We can't cache the class in the method/AST, because it would break things.
I am pretty sure this is the right way of doing it, but it might be considered surprising on first look.
The next issue that was thought of is lookup semantics inside an object literal.
I am not entirely sure yet whether that's an issue. But, I was wondering whether we might stumble over any surprising issues there that you guys might already have considered.
Thanks and best regards
Stefan