[Haskell-beginners] Cross-platform .hs files on Linux and Windows

Marius Ghita mhitza at gmail.com
Tue Apr 17 12:51:34 CEST 2012


http://en.wikipedia.org/wiki/Shebang_%28Unix%29

when it occurs as the first two characters on the first line of a text
file. In this case, the program
loader<http://en.wikipedia.org/wiki/Loader_%28computing%29>in
Unix-like <http://en.wikipedia.org/wiki/Unix-like> operating systems parses
the rest of the first line as an interpreter
directive<http://en.wikipedia.org/wiki/Interpreter_directive>and
invokes the program specified after the character sequence with any
command line options specified as parameters. The name of the file being
executed is passed as the final argument.


As you can see this is not something an interpreter is supposed to do, the
responsability is delegated to the OS's program loader. You could emulate
this under Windows, but I suppose you would be using cygwin or something
similar.

On Tue, Apr 17, 2012 at 11:13 AM, Vinay Sajip <vinay_sajip at yahoo.co.uk>wrote:

> Marius Ghita <mhitza <at> gmail.com> writes:
>
> > And thats expected given than the shebang is *nix specific.
>
> Perhaps not unexpected, but not necessary either. I may be wrong, but it
> seems
> reasonable to assume there's a common code base for the Haskell Platform
> for
> Linux and Windows versions. Presumably there's code for the parser to the
> skip
> shebang line on Linux - there's no reason why it couldn't do the same on
> Windows. As it is, it's just an unhelpful impediment to having
> cross-platform
> scripts (unless there's a good reason for it - I couldn't think of one).
>
> Coincidentally, I am working on functionality which brings shebang line
> processing to Windows, primarily for Python scripts but it also works with
> other
> scripting languages (like Perl). That's not why I posted this, though - I
> was
> just given a set of scripts and want to use them on Windows without
> changing
> them just for this.
>
> Regards,
>
> Vinay Sajip
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Google+: https://plus.google.com/111881868112036203454
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120417/43d66853/attachment.htm>


More information about the Beginners mailing list