Giter Club home page Giter Club logo

Comments (6)

lontivero avatar lontivero commented on July 20, 2024

I created an executable script called fsx:

dotnet fsi --exec "$@"

And I have added it to the PATH. This works because panda adds then the .fsx extension to the file. But it feels somehow wrong to me.

from panda.

CDSoft avatar CDSoft commented on July 20, 2024

I guess this is due to an old Microsoft convention to define the file type according to its file extension. On Unix/Linux, the file type is given by the file content which is way simpler.

Panda has a very bad heuristic to guess the appropriate extension that may only work for cmd.exe (the extension is the name of the interpretor without its extension (cmd.exe -> .cmd).

I can change this "heuristic" by an easier one. For diagrams, the image extension can be explicitly given in the command (e.g. %o.png).

Then it would be possible to write {.fsx cmd="dotnet fsi %s.fsi" } (%s.fsi would be the name of a temporary file with the extension .fsi).

from panda.

lontivero avatar lontivero commented on July 20, 2024

Yes! I like that idea.
FTR: F# inherited these conventions from OCaml so, this time is not MS.


Update: ocaml scripts work okay regardless of the extension so, it is MS

from panda.

CDSoft avatar CDSoft commented on July 20, 2024

I pushed a small update with explicit extension in the command line and a few predefined extensions.

{cmd=python} is equivalent to {cmd="python %s"} and {cmd="python %s.py"}

Some extensions are predefined too for Python, Lua, shell scripts, cmd for Windows and F#.
I.e. {cmd="dotnet fsi"} is equivalent to {cmd="dotnet fsi %s"} and {cmd="dotnet fsi %s.fs"}.

from panda.

lontivero avatar lontivero commented on July 20, 2024

Tested. Just a clarification: the extension for f# scripts is .fsx (.fs is also a f# extension but for files that are part of a project) so, i think it would be better to change. Anyway, this is much better now and this works excellently:

```{.fsx icmd="dotnet fsi --exec %s.fsx" }
open System
Console.WriteLine("Thank you @CDSoft!");
```

from panda.

CDSoft avatar CDSoft commented on July 20, 2024

Ok, I'll fix the .fsx extension.

from panda.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.