Skip to content

Instantly share code, notes, and snippets.

@kmizu
Last active January 24, 2018 11:09
Show Gist options
  • Save kmizu/5a52486f3a7015747c6caa0f1e2b0a6d to your computer and use it in GitHub Desktop.
Save kmizu/5a52486f3a7015747c6caa0f1e2b0a6d to your computer and use it in GitHub Desktop.
Nemerleで n == 1 && n == 2 && n == 3をtrueにする ref: https://qiita.com/kmizu/items/77c1f4244502c4dd4058
using Nemerle.Compiler;
macro @==(lhs, rhs) {
<[
true
]>
}
$ ncc -r Nemerle.Compiler.dll -t:dll eq_macro.n -o eq_macro.dll
using System;
class Hello
{
static Main () : void
{
def a = 1;
Console.WriteLine(a == 1 && a == 2 && a == 3);
}
}
ncc -r eq_macro.dll Hello.n -o Hello.exe
Hello.n:7:9:7:10: warning: N168: a local value a was never used (defined in 'Main() : void')
Hello.n:7:9:7:10: hint: replace name with `_' or prefix it like `_bar' to avoid the warning
$ ./Hello.exe
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment