Cobra design
Posted: Mon Feb 11, 2008 3:37 pm
Chuck, I have a few remarks and questions about the design of Cobra.
Spitting C# instead of IL
This works well for Eiffel compilers, and in benchmarks SmartEiffel often performs just as well as its backend gcc, so I hope this will work for Cobra too.
Quality
Great !
Contracts need a few samples (grepping the directory for require shows only comments ).
When I try this
I get a compiler error that says that the contract of Divider2.inverse needs an or. This is strange, because the compiler should or the old contract with the new one, like Eiffel does. Furthemore, adding a random or to the second contract didn't help ; is this a bug ?
Defaulting numbers to Decimal
I don't like that, since all other languages use int and float instead.
In the code above, my first try with inverse was but the compiler rejected it because it mixes float and Decimal. How to tell the compiler that 1.0 is a float ?
The dot
Each call to a method needs to begin with a dot. What's the point ? (No pun intended).
Lowercase members : the Math.pI syndrom
It is a pity that Microsoft doesn't use casing to distinguish classes from members, but going against it is looking for trouble.
Won't it be a problem when using classes written in C# with lowercase members ?
Tools wil have a harder job : Intellisense will have to convert names of frameworks to Cobra format, and vice versa for online help systems.
We must also assume that no (braindead) programmer will ever design a class with 2 members differing only by casing.
Spitting C# instead of IL
This works well for Eiffel compilers, and in benchmarks SmartEiffel often performs just as well as its backend gcc, so I hope this will work for Cobra too.
Quality
Great !
Contracts need a few samples (grepping the directory for require shows only comments ).
When I try this
class Divider
def inverse(x) as float
require
x > 3
body
return 1.0 / x
class Divider2
inherits Divider
def inverse(x) as float is override
require
x > 2
body
return 1.0 / x
Defaulting numbers to Decimal
I don't like that, since all other languages use int and float instead.
In the code above, my first try with inverse was
def inverse(x as float) as float
The dot
Each call to a method needs to begin with a dot. What's the point ? (No pun intended).
Lowercase members : the Math.pI syndrom
It is a pity that Microsoft doesn't use casing to distinguish classes from members, but going against it is looking for trouble.
Won't it be a problem when using classes written in C# with lowercase members ?
Tools wil have a harder job : Intellisense will have to convert names of frameworks to Cobra format, and vice versa for online help systems.
We must also assume that no (braindead) programmer will ever design a class with 2 members differing only by casing.