Regarding the more explicit "for each", I don't think it has any advantage over "for" past the first day of coding. Also, you almost never need to specify the type because Cobra can infer it. If however, you need to type the for variable, you can write "for i as int in someInts". The "<name> as <type>" syntax is ubiquitous to args, local vars, for loop local vars and even class level vars.
My motivation for putting the type last is that the name is more important. I want to read:
def cache as Dictionary<of String, List<of int>>
return ...
# not:
Dictionary<of String, List<of int>> cache:
return ...
You'll eventually notice that class declarations in Cobra line up quite nicely and are easy to scan. They are kind of "bulleted" by their declaration keywords such as "var", "def", "get" and "pro".
Cobra has a feature like your local statement "where L is a list". I call it if-inherits:
if t inherits IList
for a in t
print a
.processList(t)
You can see that unlike C# and Java, there is no typecast required on t inside the if-inherits.
Regarding parametric constraints they are already there and done in the style of Eiffel contracts. You can also constraint the return value. And you can constrain on the state of the current object, not just the parameters and return value. See
How To Declare Contracts.
"def" is kind of a funny word as there are other things you define in Cobra. But I dislike the term "subroutine" so I don't use "sub". The word "has" is already used for attributes as in "What attributes does that class/method have? It has ..." See
Cobra 0.7 Release Notes.
The use of "extend" in Java is just flat out wrong. In real life--which is where we take inspiration for our keywords--when you extend something, that something becomes longer or bigger. If I extend my patio, it's bigger afterwards. If I extend an antenna, it's longer afterwards. In Java, after you "extend" a class it's still the same class with the same capabilities. You created something new and distinct, you didn't extend the old. Cobra uses "inherits".
It seems that what you want is there functionally. The syntax isn't exactly what you want, but that would have been a rare coincidence as everyone has a different ideal syntax.