rsdn / nemerle Goto Github PK
View Code? Open in Web Editor NEWNemerle language. Main repository.
Home Page: http://nemerle.org
License: Other
Nemerle language. Main repository.
Home Page: http://nemerle.org
License: Other
Code:
public compareFiles(f1: string, f2: string): int * int * int
{
(0, 0, 0)
}
private RetryCompareButton_Click (sender : object, e : System.EventArgs) : void
{
if (!String.IsNullOrEmpty(fileNameBox1.Text) && !String.IsNullOrEmpty(fileNameBox2.Text))
compareFiles(fileNameBox1.Text, fileNameBox2.Text);
else
_ = MessageBox.Show("Извините, в текстовых полях отсутствуют имена файлов для сравнения:\r\n нажмите кнопку \"Сравнить\" или введите их вручную"): void;
}
Must be error in compareFiles, but error in MessageBox
error : expected (int * int * int)-, got void in computation branch: (int * int * int) is not a subtype of void [simple require]
It would be nice if we can specify Use specific version (true/false) from the project reference properties .
Looks like Nemerle uninstaller doesn't correctly handling VS Integration. After uninstall Nemerle is still registered in Visual Studio but is not avaliable for use. It means that Nemerle project types has gone, but Nemerle logo is still displayed on splash screen. Tested with VS08.
Go to the "Tools \ Options" dialog and in the "Text Editor \ Nemerle \ Advanced" branch switch "Use smart tab" to false.
The following code is not typed, but should.
public variant SplittedExpr
{
| SimpleExpr {val : string;}
| InnerExpr {val : list[SplittedExpr];}
}
module Program
{
Main() : void
{
def getInnerText(x : SplittedExpr.InnerExpr) : string
{
_ = !x.val.Exists(y =>
match (y)
{
| SplittedExpr.InnerExpr => true
| _ => false
}
|| (y :> SplittedExpr.SimpleExpr) // E: Can't cast
.val.Length > 0);
"\r\n" + x.val.ToString() + ")"
}
_ = getInnerText(SplittedExpr.InnerExpr([]));
}
}
When create a auto-property with quasi-quotation there is an error finding parameter 'value' in setter.
Code sample:
def name= "PropertyName";
def prop= <[ decl: public $(name : usesite) : void -> bool {get;set;}]>
Notepad does not open the file correctly.
The latest VS10 integration generates System.IO.PathTooLongException while installing extension.
Log: http://paste.org.ru/?h061m5
Visual Studio's text editor when using Edit | Advanced | Format Document (or Format Selection) considers current tab settings.
But in VS Integration all Nemerle code formatted with default tab size which is 2. So changing this value in Tools | Options | Text Editor | Nemerle | Tabs doesn't affects on formatting behavior.
It's not only VS2010 problem, both VS08 and VS10 integrations are ignoring tab settings.
module Program
{
mutable i : int;
mutable o : object;
public Main() : void
{
M(out i);
M(ref o);
}
public M(a : out int) : void
{
a = 10;
}
public M(o : ref object) : void
{
}
}
Code above generate these warnings
N649: field `i' is never assigned to, and will always have its default value
N649: field `o' is never assigned to, and will always have its default value
But since a and o uses as ref and out, compiler shoudn't assert that a and o is NEVER assigned.
Here's the macro:
[Nemerle.MacroUsage (Nemerle.MacroPhase.BeforeInheritance, Nemerle.MacroTargets.Class,
Inherited = true)]
macro UnitTestFixture (type : TypeBuilder)
{
type.GetModifiers().AddCustomAttribute (<[ TestFixture ]>);
def methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public);
foreach(method in methods)
{
def methodInfo = method.GetMethodInfo();
def modifiers = method.GetModifiers();
modifiers.AddCustomAttribute (<[ NUnit.Framework.TestAttribute ]>);
}
}
Here's how I use the macro:
[UnitTestFixture()]
public class OptionalHeaderTests
{
public SomeTest() : void
{
}
}
The resulting class should look like this after compilation:
[TestFixture]
public class OptionalHeaderTests
{
[Test]
public SomeTest() : void
{
}
}
...but instead, it looks like this (in C#):
using Nemerle.Internal;
using NUnit.Framework;
using System;
namespace Tests
{
[Macro("Tests.Macros.UnitTestFixture:type:postscan", 0, ""), TestFixture]
public class OptionalHeaderTests
{
public void SomeTest()
{
}
}
}
So what do I have to do with the macro to make it work?
If regional settings has ',' as decimal point separator the Project Conversion Wizard run on each project open (including project creation).
For now it is possible to add native dll to project's references folder. By doing this You're provoking integration to be involved in infinitive loop of parsing\building type tree which causes huge memory allocations. And VS becomes unusable.
Is there any way Nemerle can create binaries that don't need to reference Nemerle.dll? I'm trying to cut down on external dependencies, and having to depend on Nemerle.dll when I'm barely using any of its functionality seems a bit ridiculous.
Add new item template which open wizard dialod to create macro file. This wizard support all type of macros.
Added the ExtensionPattern assemble level macroattribute.
This macroattribute allow to add Extension Patterns for types from referenced (external) assemblies.
This macroattribute make Extension Patterns only in scope of current project.
Add template for variant data type.
Is it possible to give a tips to user about constructor parameters by default? When you creating new instance of some class which has some parameters in its constructor you wouldnt recieve intellisense support. To get parameter list you need to press "ctrl + shift + space" combination. Any chances to get this tooltip by default after typing opening brace?
Currently, when typing code in the VS2010 editor it will auto-complete words as you type. This is not the desired behavior if you are templating code using classes not yet written implemented, as it will often choose the wrong thing and automatically insert it into your code as you are typing. The suggestion/standard completion mode toggle would usually resolve this, but it is greyed out when using Nemerle.
Tab press should adjust selection in visual studio editor, this is normal behaviour. If you press Tab key while editing Nemerle Project in visual studio, selection will be not moved to the right, as usual in VS, if you edit c# project. To achieve text adjusting, you should press Home key first, to move the cursor to the beginning of the first selected line. Then Tab key works as expected.
----- Build started: Project: ConsoleApplication1, Configuration: Debug Any CPU ------
C:\Program Files (x86)\Nemerle\ncc.exe
/no-color
/no-stdlib
/greedy-references:-
/define:DEBUG;TRACE;SkipPostSharp
/target:exe
/debug+
/project-path:F:\Projects\NemerleTests\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.nproj
/root-namespace:ConsoleApplication1
Main.n
Properties\AssemblyInfo.n
/ref:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll"
/ref:"C:\Program Files (x86)\Nemerle\Nemerle.dll"
/ref:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Core.dll"
/ref:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.DataSetExtensions.dll"
/ref:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.dll"
/ref:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.dll"
/ref:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Xml.dll"
/ref:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Xml.Linq.dll"
/macros:"C:\Program Files (x86)\Nemerle\Nemerle.Linq.dll"
/out:obj\Debug\ConsoleApplication1.exe
C:\Program Files (x86)\Nemerle\Nemerle.MSBuild.targets(230,9): error : internal compiler error: got some unknown exception of type System.BadImageFormatException: Could not load file or assembly 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
at System.Reflection.AssemblyName.nGetFileInformation(String s)
at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
at Nemerle.Compiler.LibraryReferenceManager.assemblyLoadFrom(String path)
at Nemerle.Compiler.LibraryReferenceManager._N_assembly_by_name_53499(_N_closure_53491 _N_LookupAssembly_cp_53498, String path)
at Nemerle.Compiler.LibraryReferenceManager.LookupAssembly(String name)
at Nemerle.Compiler.LibraryReferenceManager.AddLibrary(String name)
at Nemerle.Compiler.ManagerClass._N_tryEx_24889(_N_closure_24873 _N_LoadExternalLibraries_cp_24888, FunctionVoid f)
at Nemerle.Compiler.ManagerClass._N_foreach_loop_24959(_N_closure_24873 _N_LoadExternalLibraries_cp_24958, list`1 _N_wildcard_2417)
at Nemerle.Compiler.ManagerClass.LoadExternalLibraries()
at Nemerle.Compiler.ManagerClass.Run()
at Nemerle.CommandlineCompiler.MainClass.main_with_catching()
Done building project "ConsoleApplication1.nproj" -- FAILED.
Build FAILED.
GetFrameworkPaths failed -- 0 errors, 0 warnings. Build took: 00:00:00.0621246.
Build has been canceled.
00:00.077 - Failed - Debug Any CPU - ConsoleApplication1\ConsoleApplication1.nproj
Total build time: 00:00.082
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
1-) Create a new ASP.NET Web Project
2-) Right click to project from solution folder and click Start With Debugging (optionally enable debugging)
VS will give an error that it is unable to start debugging
Additionally adding new controls to aspx , causes incorrect/missing code designer page
Workaround:
Somehow unload and reload the project everything works properly.
Following example generate incorrect IL:
using System;
using System.Console;
module Program
{
Main() : void
{
mutable arg;
Test(out arg);
WriteLine(arg.Field1);
_ = ReadLine();
}
mutable cond : bool = false;
Test(arg : out Struct1) : void
{
arg.Field1 = if (cond) "1" else "2";
}
public struct Struct1
{
public mutable Field1 : string;
}
}
Output of PEVerify:
[IL]: Error: [E:\MyProjects\Tests\ConsoleApplication355\ConsoleApplication355\bin\Debug\ConsoleApplication355.exe : Program::Test][offset 0x00000003][found address of value 'Program+Struct1'][expected value 'Program+Struct1'] Unexpected type on the stack.
[IL]: Error: [E:\MyProjects\Tests\ConsoleApplication355\ConsoleApplication355\bin\Debug\ConsoleApplication355.exe : Program::Test][offset 0x00000021][found value 'Program+Struct1'][expected readonly address of value 'Program+Struct1'] Unexpected type on the stack.
2 Error(s) Verifying ConsoleApplication355.exe
Note: This example crash on .net 4.0 x86, but work fine on x64.
This is a similar issue to #768 on the old google code tracker. If two types are implicitly convertible, they are sometimes unusable with function overloads. For example:
class A {
public static @:(b:B):A {A();}
}
class B {
public static @:(a:A):B {B();}
}
class MainN {
public static Foo(a:A,b:B):void {}
public static Foo(a1:A,a2:A):void{}
public static MainD():void
{
Foo(B(),B());
}
}
This results in "typing fails on ambiguity between overloads". The equivalent C# code works as expected:
class A { public static implicit operator B (A a) { return new B(); } }
class B{ public static implicit operator A (B b){ return new A();}}
class MainCS
{
static void Foo(A a, B b) { }
static void Foo(A a1, A a2) { }
static void Main(string [] args)
{
Foo(new B(), new B()); // This works with a call to the first overload
}
}
A comment from before stated that "This is because when we compare overloads we don't take implicit conversion into account, so A and int are incomparable."
I'd be willing to look into the issue myself, but I'm rather new with Nemerle and I'm not sure where I'd even get started.
Include - Unevaluated MSBuild 'Include' item value.
Runtime Version - Version of the common language runtime (CLR) or version of Mono runtime this assembly compiled against.
Version - Version of referenced assembly.
C# editor can help you with list of methods that can be overriden inside the class. To recieve a help you just typing "override" then after pressing spacebar you recieving list with methods avaliable for override. When you choose one of them editor will copy signature from metadata. Is it possible to make this inside Nemerle Integration?
Currently when a class is created in a folder IDE ignored the folder and just put the project name as the default namespace.
It would be nice if IDE recognize that we put the class in a folder and generate relevant namespace. This is the C# behaviour
Add VS 2010 template for module data type.
The following code fail:
[MacroUsage(MacroPhase.BeforeTypedMembers, MacroTargets.Class)]
macro DefineVariantoption_on_BeforeTypedMembers(typeBuilder : TypeBuilder, optionName : PExpr)
{
def variantOptionBuilder = typeBuilder.DefineNestedType(
<[ variant_option: | $(optionName.ToString() : usesite) { public override ToString() : string { "defined on BeforeTypedMembers" } } ]>);
variantOptionBuilder.Compile(); // ICE: Exception=NRE
}
[MacroUsage(MacroPhase.WithTypedMembers, MacroTargets.Class)]
macro DefineVariantoption_on_WithTypedMembers(typeBuilder : TypeBuilder, optionName : PExpr)
{
def variantOptionBuilder = typeBuilder.DefineNestedType(
<[ variant_option: | $(optionName.ToString() : usesite) { public override ToString() : string { "defined on WithTypedMembers" } } ]>);
variantOptionBuilder.Compile(); // E: no _N_GetVariantCode() defined
}
public M(a : out int) : void
{
}
Should generate compilation error, because a is not assigned on all path of M.
Intellisense works only in the methods from the module that is automatically generated by the wizard.
Inside the macro body Intellisense shows just keywords.
В конструкциях
, где notDisposable - не наследует IDisposable, не выдается ошибки в табе Error list.
Хотя в output можно увидеть:
Done building project "DocBrowser.Tests.nproj" -- FAILED.
using System.Collections.Generic;
module Program
{
Main() : void
{
def xs1 = List.[string]();
foreach (_x in xs1 ?? array(0)) // ICE
();
}
}
See http://www.jetbrains.com/resharper/features/coding_assistance.html#Import_Symbol_Completion
Shortcut: Shift + Alt + Space
Флаг AllowMultiple при определении макроатрибута игнорируется
AllowMultiple flag is ignored
assert($"\r\n" == "\r\n") // fail
In a Nemerle Project if you add a C# file with BuildAction Compile,
Though the project compiles fine, the Error pane is full of errors, as if the compiler compiles the C# file expecting Nemerle syntax.
This is very annoying because it hides the actual compiler errors.
Add to VS 2010 Integration support of project conversion wizard which will be convert project to new format.
Memory leak on reparse a project in IDE.
When we write "override" in a class, IDE should show us possible overrrides. This is the default C# behavior for IDE.
Try to wrap your code with named region like this:
// code
Then collapse this region. At this moment region will be displayed as rectangular area with text inside. Save file which contains this region. Then close and open this file again. After reopening you will see that your region is displayed as "..." now.
Workaround: press "Outlining | Toggle All Outlining" twice. Then collapse your region. It will save its name until you close file.
see closed #55 (I does not reopen)
therefore, #55 is a bug.
Собрал последние на текущий момент исходники Nemerle.
Создал проект Nemerle Console App (.Net 3.5).
При добавлении сборки System.Reactive (последняя версия Reactive Extensions 3.5) появляется ошибка
Nemerle Visual Studio Integration
Error: assertion failed in file ncc\external\LibraryReferenceManager.n, line 530: not loaded internal type... file:///C:/Users/Acer/AppData/Local/Microsoft/VisualStudio/10.0Exp/Extensions/Nemerle Team/Nemerle Visual Studio 2010 Integration/1.0/Nemerle.Compiler.Utils.dll:System.Reactive.Notification`1[T]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.