Imagine Cup 2007 disappoints Nemerele’rs
Matt Nedrich from NTSig sent out a message recently about Imagine Cup 2007, and I was interested to check out their software design competition. However, I was more interested to find out you can compete using alternate languages, as long as you make a valid .NET 2.0 assembly. I took this as a chance to write some code in Nemerle, a functional .NET language that has some cool tricks (and as one knows, one must always use cool tricks in programming competitions). However, even after downloading KChmViewer to read their specs and resubmitting several times, I can’t get their site to accept a .DLL written in Nemerle. Here’s my code (since it’s the tutorial, I don’t think it’s cheating to share):
public class MathHelper
{
public static Add(a:int, b:int) : int {a+b;}
public static Subtract(a:int, b:int) : int {a-b;}
public static Multiply(a:int, b:int) : int {a*b;}
public static Divide(a:int, b:int) : int {a/b;}
}
}
and here’s the monodis output:
{
.ver 2:0:0:0
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
}
.assembly ‘L100Math’
{
.custom instance void class [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = (01 00 08 00 00 00 00 00 ) // ……..
.hash algorithm 0×00008004
.ver 0:0:0:0
}
.module L100Math // GUID = {DA51AA57-2311-42ED-B694-827673D18D36}
.namespace L100Math
{
.class public auto ansi MathHelper
extends [mscorlib]System.Object
{
// method line 1
.method public hidebysig specialname rtspecialname
instance default void .ctor () cil managed
{
// Method begins at RVA 0×20ec
// Code size 7 (0×7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void object::.ctor()
IL_0006: ret
} // end of method MathHelper::.ctor
// method line 2
.method public static hidebysig
default int32 Add (int32 a, int32 b) cil managed
{
// Method begins at RVA 0×20f4
// Code size 4 (0×4)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add.ovf
IL_0003: ret
} // end of method MathHelper::Add
// method line 3
.method public static hidebysig
default int32 Subtract (int32 a, int32 b) cil managed
{
// Method begins at RVA 0×20fc
// Code size 4 (0×4)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: sub.ovf
IL_0003: ret
} // end of method MathHelper::Subtract
// method line 4
.method public static hidebysig
default int32 Multiply (int32 a, int32 b) cil managed
{
// Method begins at RVA 0×2104
// Code size 4 (0×4)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: mul.ovf
IL_0003: ret
} // end of method MathHelper::Multiply
// method line 5
.method public static hidebysig
default int32 Divide (int32 a, int32 b) cil managed
{
// Method begins at RVA 0×210c
// Code size 4 (0×4)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: div
IL_0003: ret
} // end of method MathHelper::Divide
} // end of class L100Math.MathHelper
}
Am I doing something wrong? That looks pretty correct, I used “ncc -tdll -o L100Math.dll L100Math.n” as my compile command. Thoughts? Comments? Ideas?