struct наносит ответный удар
От: Klapaucius  
Дата: 20.06.07 17:54
Оценка:
Некоторое время назад я уже сталкивался с багом, связанным с этим констрейнтом. Тот баг благополучно исправили. Но беда пришла снова, откуда не ждали.
using System;
using System.Console;
using Nemerle.Utility;

module Foo[T] 
    where T : struct
{
    public foo() : void
    {
        WriteLine("foo!")
    }
}

type Bar = Foo[int];

using Bar;

module Program
{
  Main() : void
  {
    Foo[int].foo(); //ok
    Bar.foo(); //ok
    foo(); //Error
    
    //the type `System.Object' must be a value type in order to use 
    //it as type parameter `T' in Foo[System.Object]
  }
}


Но может быть в этом и есть сермяжная правда? Может я что-то не то делаю?
'You may call it "nonsense" if you like, but I'VE heard nonsense, compared with which that would be as sensible as a dictionary!' (c) Lewis Carroll
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.