[nem-en] Operator overloading on external types

vc vc at rsdn.ru
Tue Jun 12 15:53:42 CEST 2007


The following test work well, but similar C# program will fail (in C# we can
overload operators only for yours types).
This is expected behavior?

using System;
using System.Console;
using Overl; // This is expected behavior?

module Overl
{
  public @+(date : DateTime, delta : long) : DateTime // This is expected
behavior?
  {
    def d = TimeSpan(delta);
    date + d
  }
}

module Program
{
  Main() : void
  {
    def now = DateTime.Now;
    WriteLine(now);
    WriteLine(now + 20000000L);
    _ = ReadLine();
  }
}




More information about the devel-en mailing list