New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code with Using keyword not compile alone without Main method #191

ghost opened this Issue Dec 1, 2011 · 0 comments


None yet
0 participants
Copy link

ghost commented Dec 1, 2011

This code:

using Nemerle;
using System;
using System.Console;
using System.IO;

    File.WriteAllLines(@"test.txt", array["This is a test file.", "It is easy to read."] );

    using (sr = File.OpenText("test.txt"))
      def line1 = sr.ReadLine();
      def line2 = sr.ReadLine();
      WriteLine($"line1 = $line1");
      WriteLine($"line2 = $line2");

not work in file alone, without using Main method in module, but Nemerle allow code without class, it must automatical creates entry point for it.
Error signs:

E:\OpenSource\Nemerle\samples\ConsoleApplication1\ConsoleApplication3\Main.n(8,11): error : expected qualified identifier, got token (
E:\OpenSource\Nemerle\samples\ConsoleApplication1\ConsoleApplication3\Main.n(8,10): error : expecting `;' or `='
E:\OpenSource\Nemerle\samples\ConsoleApplication1\ConsoleApplication3\Main.n(9,5): error : expected `;'
E:\OpenSource\Nemerle\samples\ConsoleApplication1\ConsoleApplication3\Main.n(9,5): error : parse error near `{...}' group: unexpected token after expression in sequence (you forget a closing bracket?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment