[svn] r5850: nemerle/trunk/snippets/course/getmxbyname.n

nazgul svnadmin at nemerle.org
Tue Oct 25 22:04:43 CEST 2005


Log:
Use strong typing there

Author: nazgul
Date: Tue Oct 25 22:04:39 2005
New Revision: 5850

Modified:
   nemerle/trunk/snippets/course/getmxbyname.n

Modified: nemerle/trunk/snippets/course/getmxbyname.n
==============================================================================
--- nemerle/trunk/snippets/course/getmxbyname.n	(original)
+++ nemerle/trunk/snippets/course/getmxbyname.n	Tue Oct 25 22:04:39 2005
@@ -6,17 +6,14 @@
 
   // rekord MX
   [Record]
-  public class MX : System.IComparable
+  public class MX : System.IComparable [MX]
   {
     // priorytet (preferowane sa rekordy z mniejszym)
     public mutable pref : int;
     // nazwa serwera obslugujacego wymiane poczty
     public mutable host : string;
     // metoda porownujaca z interfejsu IComparable
-    public CompareTo(obj : System.Object) : int {
-      unless (typeof (MX).Equals (obj.GetType()))
-        throw System.ArgumentException ();
-      def mx = (obj :> MX);
+    public CompareTo(mx : MX) : int {
       // odwracam porzadek, bo preferowane sa serwery o mniejszym numerku
       -pref.CompareTo(mx.pref)
     }



More information about the svn mailing list