Enter Lyra
- Implementation in Lyra takes place along with declaration. No more separated implementation for sections, for including executable content.
- Property and event implementations have changed accordingly. The new implementation syntax is very compact and easy to understand, and uses four new special "keywords": get:, set:, add: and remove:. Semicolons are an integral part of the corresponding tokens, and they avoid both those dirty contextual keywords and disturbing valid identifiers in existing code.
- Interface delegation is supported, but it has moved to the implementing member declaration.
- Constructor calls now requires parentheses, except when followed by a list initializer.
- In compensation, constructor calls can now start an object path.
- Local variable declarations have been moved to the statement list, as declaration statements. This trick avoids some syntactic anomalies while defining properties and events.
property Items[Index: Integer]: Boolean;
get:
// Compound assignments are not expressions.
Index -= Min;
// then is optional before a keyword.
if Index < 0 or Index > High
raise new ArgumentException("Index");
// Symbolic and literal operators are both allowed.
Result := (Bits[Index div 32] &
(1 << (Index mod 32))) <> 0
set:
Index -= Min;
if Index < 0 or Index > High
raise new ArgumentException("Index");
if Value then
Bits[Index div 32] |= 1 << (Index mod 32)
else
Bits[Index div 32] &= ~(1 << (Index mod 32))
end
- Anonymous methods and lambdas are still missing. Probably, I'll implement only one of the syntactic varieties, but I still have some troubles with the syntax: C#'s lambdas, when implemented verbatim, don't make a valid LALR(1) grammar.
- I still believe in the usefulness of access sentinels: wrapping code that would be inserted by the compiler around methods that access some class members. This is a safe form of Aspect Oriented Programming (and no, properties don't do the same trick!)
- Lyra will feature mixins declared with interfaces. You'll be able to add common implementation methods to interfaces, as in this example:
IStack = interface[X]
property Count: Integer; readonly;
method Push(Value: X);
method Pop: X;
// These are the new "mixins":
property IsEmpty: Boolean =>
Count = 0;
method Push(Values: IEnumerable[X]);
begin
for v in Values do Push(v)
end
method Clear;
begin
while Count > 0 do Pop
end
end
- It's some kind of funny that extension methods (that's what mixins are, at the end of the day), access sentinels and assertions are related by their implementations. For instance, pre and postconditions are implemented in Freya as extension methods. Class invariants' implementation, on the other hand, uses a similar approach as data sentinels to avoid firing in internal call boundaries.
- I must acknowledge that most assertion implementations I know, beyond Eiffel, are shallow, incomplete or plainly wrong. Most of them don't handle inheritance and don't support assertion on interface types. Assertions in Freya addressed these problems, and Lyra will continue enhancing assertions support.
- I have to complete the "Intellisense" compiler. This is a second (lighter) compiler that must take care of class navigation and code completion. I can't use the main compiler: it performs some code generation tasks very early in the compiling process.
- Of course, Visual Studio integration is still an important item in the shopping list, just as CodeDOM support is.
- Compiling must be moved to an isolated application domain, in order to avoid problems when unloading compiled assemblies.
- Dynamic methods and "dynamic programming" support, you said? Huh, I hate the very concept! But you were kidding, weren't you?