Live data from Hacker News

Batsh – A language that compiles to Bash and Windows Batch

batsh.org

51–60 of 130 posts

Re: Batsh – A language that compiles to Bash and Windows Batch

#51
post #26
post #5

I would have preferred a bash/powershell solution. Hoping no one is still writing batch files on windows... even if he is still using xp

300 million machines still on XP guys..

Yup, and that's the problem, not bat vs ps1. People said the same things when 98 was EOLed. XP is dead.

Re: Batsh – A language that compiles to Bash and Windows Batch

#52
post #5

I would have preferred a bash/powershell solution. Hoping no one is still writing batch files on windows... even if he is still using xp

For simple use cases I still use batch files as the performance is much greater. Powershell feels too heavy when I just want to run a build with some parameters and a couple of other commands.

I think it's really interesting the way programmers will use phrases like, "it feels heavy", as a way to describe using programs that contain unused features. I'm guilty of the same. Powershell "feels heavy" because it is a lot more sophisticated than batch, you can do all sorts of cool things with WMI or use data structures, but in the end, what does programming in batch actually gain you? If performance is such a problem that you notice a performance penalty when switching between shells, something is seriously wrong.

But I'm guessing you don't really notice the performance difference, you just feel the weight of unused features.

Re: Batsh – A language that compiles to Bash and Windows Batch

#53
post #5

I would have preferred a bash/powershell solution. Hoping no one is still writing batch files on windows... even if he is still using xp

There are still need for real pipe (no buffering) and ASCII I/O redirection. (Not sure if the latter is possible now, though)

Re: Batsh – A language that compiles to Bash and Windows Batch

#54
1. From UNIX point-of-view, not all has the luxury of bash, so seems to be quite limited to a certain modern platform? I found out ksh are more prevalent

2. I actually use UnxUtils in windows so I can has POSIX command option (and scripting). Performance-wise, never tested as not needed, all short command / simple script

Re: Batsh – A language that compiles to Bash and Windows Batch

#55

Earlier quoted context omitted.

For simple use cases I still use batch files as the performance is much greater. Powershell feels too heavy when I just want to run a build with some parameters and a couple of other commands.

I think it's really interesting the way programmers will use phrases like, "it feels heavy", as a way to describe using programs that contain unused features. I'm guilty of the same. Powershell "feels heavy" because it is a lot more sophisticated than batch, you can do all sorts of cool things with WMI or use data structures, but in the end, what does programming in batch actually gain you? If performance is such a p…

The opposite effect is, IMO, how things like node.js gain in popularity - the environment "feels fast" and "feels simple" [for the simple use cases that are always at the start of things].

Re: Batsh – A language that compiles to Bash and Windows Batch

#56
post #4

This implementation is not perfect, although it's interesting that it supports Windows. I personally don't care about that, but it brings the idea to create some sugary wrapper around Bash that allows you to use Bash v4 features such as associative arrays in Bash v3, and wrappers that allow functions to return arrays and other typical headaches.

My initial thought after seeing this is Windows support is interesting, but the real value is in making bash friendlier. Something that brings syntactic sugar to bash is welcome in my mind, as I always find myself putzing with Google to find solutions to even slightly non-trivial scripts.

Perhaps I should just master bash scripting once and for all (I know it's not that complex), but I generally find it unpleasant to do anything that requires control flow or traditional "programming language logic" in bash.

A simple way to bootstrap the compiler with the script itself would be especially nice. Basically, an embedded batsh compiler. Might be an interesting avenue for an enterprising person to look into.

Re: Batsh – A language that compiles to Bash and Windows Batch

#57
So are we really supposed to install OCaml and compile it or do we use it as a hosted service? I can see that you just post a batsh script and specify your output, but I don't know if that's intended for public consumption. Otherwise this just looks like a POC.

Re: Batsh – A language that compiles to Bash and Windows Batch

#58
post #28

Earlier quoted context omitted.

Totally agree. Powershell is what you need to use on windows. It's been available on the default server install since 2008 R2. No need for batch scripts anymore.

This sounds like you're saying that it suits your needs, therefore we should take that as meaning it fits our needs. Unfortunately, things are not that simple. I needed to do something and looked at using powershell, but in the end I couldn't just distribute it and have it work for whomever would be using my project. It needed to be signed or something. On the contrary, the bat script I wrote just worked and would ju…

  PS> Set-ExecutionPolicy Unrestricted
It's the first line of just about every publicly-distributed script (including Chocolately, etc).

Re: Batsh – A language that compiles to Bash and Windows Batch

#59
post #33

Earlier quoted context omitted.

I reckon you don't, because it's not supported in windows batch. Sure it is: http://www.microsoft.com/resources/documentation/windows/xp/...

Only half-way; it doesn't stream the data, it waits for the first command to finish, saves the entire output, then starts the second command with output as input.

That was true in MS-DOS and Windows 9x. Fixed in Windows NT.
Post reply on HN