C#
interface IA {}
class M
{
static void F<T>() where T : IA, new() {} // OK
static void G<T>() where T : new(), IA {} // The `new()' constraint must be the last constraint specified
static void Main() {}
}
Nemerle:
interface IA {}
module M
{
F[T]() : void where T : IA, new() {} // OK
G[T]() : void where T : new(), IA {} // OK
Main() : void {}
}
Почему new() у C# требуется, чтобы стоял в конце ?
Баг Nemerle или наоборот фича ?
Здравствуйте, _nn_, Вы писали:
__>Почему new() у C# требуется, чтобы стоял в конце ?
По спецификации
__>Баг Nemerle или наоборот фича ?
Вот что пишет Липперт по этому поводу:
Indeed, there is a cost to the proposed feature, with little benefit, and opportunity costs. The opportunity costs are not just that time spent doing that feature is taken away from other worthy features; it is also that any time we allow variation in a syntax, that makes it more difficult to extend or modify that syntax in the future
Предлагаю считать фичей nemerle (несущественной).