FAQ - vilinski/nemerle GitHub Wiki

Interop with .Net: Is it possible to use Nemerle compiled Assemblies in C# code?

Yes, it is possible. From version 0.2 and up, Nemerle is -for all practical purposes- a full CLS consumer and extender. Thus, one can extend any CLS compliant class in Nemerle regardless of what language it was created in. Other such languages can also extend classes created in Nemerle. The one, fairly obvious, caveat is that features exclusive to Nemerle (like variants) can't be used in public interfaces. .NET generics can also be referenced between Nemerle and C# 2.0 freely.

Can I create a program using Windows Forms on my Windows XP box?

Yes, you can. You can use System.Windows.Forms to create GUIs for Windows (Not yet fully working in Mono). A very simple test application using these libraries is featured here. Gtk# is a more platform independent alternative.

You can compile the example program with following command:

ncc form.n -r System.Windows.Forms -o form.exe

Could you please provide an example of a macro definition, which can be compiled with ncc?

An example macro, the code using it, and the full compilation process is now described on the macros tutorial page.

What does "Nemerle" mean?

It is inspired by the name of the mage Nemmerle in Ursula K. Le Guin's book "A Wizard of Earthsea" (spelling with a single 'm' is a design decision ;-) )

Does Nemerle run on Mono?

Yes, it does. As a matter of fact, Mono is currently our primary development platform. We have developers working both on Linux (Mono) and Windows (.Net Framework 2.0). We are planning to widen our support for more .Net runtime environments.

Why aren't method parameter and return types in classes inferred like local function's types are?

This is a design decision. Explicitly stating these types allows for better interoperability. Additionally, classes with explicitly stated public method types are clearer and easier to understand. Type inference for private functions is being considered.

Why doesn't fun(x){x.foo} compile?

After a great deal of work on a better type inference engine, we are proud to say that such code now compiles in most cases. The inference engine will gather information about the type of x from the usage of fun.

Why aren't "break" and "continue" used in Nemerle ?

These constructs are forms of "goto", and they don't stylistically fit into Nemerle. We encourage programmers to instead structure their code into local functions and use the Block construct. Blocks are a more local and expression oriented way of breaking control flow. Though we discourage it, you can alternatively just import the Nemerle.Imperative namespace and use "break" and "continue" as you like.

How do you debug a Macro - is there anything like Lisp's macro-expand?

There is a compiler switch -dt, that dumps the typed trees (after macro expansion) of expressions.

What are variants internally? Are they treated as structs or classes. Are they passed by value?

Variants are classes internally. Reflecting this, they are passed by reference. Every variant option is itself a nested class extending the variant in which it resides. This allows methods which work with a variant to work with its options.

⚠️ **GitHub.com Fallback** ⚠️