Can I supply the assmebly version and assembly informational version to the F# compiler using command line arguments rather than having to generate a file? How?
This is now tracked by https://github.com/Microsoft/visualfsharp/issues/3549 and has been accepted at least as a feature request.
Related
I am trying to use the Dafny-to-Python compiler that is suggested in Dafny's reference (25.7.7): http://dafny.org/dafny/DafnyRef/DafnyRef.html#2577-python
However, I cannot run the first step for it in the terminal: dafny build --target:py A.dfy, since I get the error: Dafny: Error: unknown switch: --target. I use Use /help for available options as they suggest, but have no idea on how to solve.
Just in case, I also attempted using the old version of the command (see 25.8.11. in the same reference): dafny Hello.dfy -compileTarget:py but then got message Dafny: Error: Invalid argument "py" to option compileTarget.
Any idea? Note that the authors themselves clearly state that The Dafny-to-Python compiler is still under development.
PS: I usually use Dafny in Visual Studio and not in the terminal, so maybe I lack some kind of library or something.
Neither the new CLI nor the Python compiler are supported by the very outdated version of Dafny you are using. You are presumably not using the correct VS Code extension, so I would start there. As of today, this should install 3.10.0 at /Users/$USER/.vscode/extensions/dafny-lang.ide-vscode-3.0.3/out/resources/3.10.0/github/dafny/Dafny.dll. To see how to use the dll, try hitting F5 with a Dafny file opened in VS Code. The Python compiler is complete and passes all tests these days.
Is it possible to parse Java files that are external to the eclipse environment? I have only realised operations related to obtaining an AST(s) from Eclipse file (or projects).
Does the current version of Rascal support Java 8?
Yes to the first question:
you could use lang::java::m3::Core::createM3FromDirectory, or read its definition and make your own version.
this code uses setEnvironmentOptions to the JDT's Java compiler for controlling the classpath and the sourcepath of the compiler.
there is no dependency on Eclipse as a whole
To the second question:
No: the current stable release is pre Java 8
Yes: the current unstable release should work for Java 8. There are no specific tests for this yet, so you may be in for some early adopter surprises.
The following F# fragment seems to be valid only if compiled in ML compatibility mode (run it here):
let i = (1 lxor 5)
However I can't compile it in a trivial project in Visual Studio 2012 or using fsc.exe from the command line. I get the error:
error FS0039: The value or constructor 'lxor' is not defined
Reading the F# spec it says
Although F# reserves several OCaml keywords for future use, the /mlcompatibility option enables the use of these keywords as identifiers.
It then lists lxor as one such operator. So I tried the command line fsc.exe Program.fs --mlcompatibility (version 11.0.60610.1), but it stil get the same error.
The documentation for fsc.exe seems to indicate that the mlcompatbility option only ignores warnings. I didn't see any other relevant options in fsc's documentation or project options in VS to enable compatibility.
All of the other SO questions about F#/ML compatibility seem to be related to which language constructs can be used, but all I'm looking for is how to actually compile in compatibility mode. Do I have to open a specific namespace, reference another assembly, or do something else?
Update
I have also tried using the open source compiler fsharpc (F# 3.0) on Mono on Ubuntu 13.04. The result is the same as fsc.
The --mlcompatibility option only turns off warnings, so this looks like a regression. YOu can verify this by searching the source for all references to mlcompatibility here https://github.com/fsharp/fsharp/search?q=mlCompatibility&type=Code.
When calling fsc (fsharpc on non-Windows systems), the compiler options go before the source filenames. So the correct way to call it would be something like:
fsc -o:MyProgram.exe --mlcompatibility Program.fs
When compiling with Visual Studio, you can go into the project's properties and add --mlcompatibility to the Other flags box:
Trying to parse a simple json string with the FSharp.Data.Json library and am faced with the following error. I am using F# 2.0 interactive. Any thoughts on how to go about solving the error
JsonValue.Parse(#"{""id"": ""117sds""}");;
System.MissingMethodException: Method not found: '!!0 Microsoft.FSharp.Collections.SeqModule.ExactlyOne(System.Collections.Generic.IEnumerable1<!!0>)'.
at FSharp.Data.Json.JsonParser..ctor(String jsonText, FSharpOption1 culture)
at FSharp.Data.Json.JsonValue.Parse(String text, FSharpOption`1 culture) in C:\Tomas\Projects\FSharp.Data\src\Library\Json.fs:line 215
at .$FSI_0063.main#()
As Jack pointed out, the F# Data library really only works with F# 3.0. If you can update the F# version, it will work and you'll get other benefits (like type providers).
If you cannot upgrade then you can probably just copy the file with JSON parser and runtime to your project and change a few things to support F# 2.0 (the licence allows that). The file you need is Json.fs.
I don't think we'd want to support 2.0 version (so far), but if the fix is easy, submit a pull request with the change and we can merge that to make this easier for others.
Seq.exactlyOne is a method which is only available in F# 3.0. Unfortunately, there's not going to be an easy way to use the FSharp.Data library from within F# 2.0.
As of version 1.1.6, the runtime components (Json parser, Csv parser and Http utilities) no longer use any method not present in FSharp.Core 4.0.0.0 (the F# 2.0 version), so you'll be able to use FSharp.Data with F# 2.0 if you don't use the type providers
This is doubtless something obvious, but downloading the F# PowerPack from codeplex and running fshtmldoc produces this error:
clements$ mono ./fshtmldoc.exe FSharp.PowerPack.dll
Processing 'FSharp.PowerPack.dll'...
Unexpected failure while writing HTML docs: An exception was thrown by the type initializer for Microsoft.FSharp.Metadata.AssemblyLoader
This is using mono 2.6.3, F# 2.0 1.9.9.9, & OS X 10.6.3 on a 32-bit intel processor.
Any help would be appreciated.
Many thanks,
John Clements
(repost from powerpack online discussion group--no response there)
At IntelliFactory we are so fed up with fshtmldoc.exe that we started an alternative project:
https://bitbucket.org/IntelliFactory/if-doc
It is still in beta but it quickly approaching being useful. I have not tried it on Mono yet but am interested in supporting it on Mono.
The key difference between our tool and fshtmldoc is that our tool uses Mono.Cecil instead of linking to the assemblies being documented. This means that it does not fail when those assemblies are in a different folder or their references are missing.