class Test[T]
{
public mutable val : T;
}
class Test2
{
public mutable test = Test () : Test[int]
}
//Почему так можно:
def x : Test[int] = Test();
//или так
def x = Test() : Test[int];
//а вот так нельзя:
def x = Test[int] (); //tests.n:11:9:11:18: error: cannot find any suitable indexer in void -> Test[?]
и почему компилятор пропускает такое:
def y = Test2; //вместо правильного def y = Test2();
y.test.val = 5; // выдает ошибку здесь, хотя, по идее, должен на строчку выше
/*
tests.n:14:1:14:11: error: unbound name `test' in `y'
tests.n:14:1:14:14: error: expected int-, got int in assigned value
*/
30.01.07 18:03: Перенесено модератором из 'Декларативное программирование' — IT