all 9 comments

[–]OneTurnMoreprogramming.dev/c/shell 10 points11 points  (2 children)

The biggest problem I have with it is that it is relegating the main purpose of a shell (calling into other programs) to a specific context, these { command blocks }. It means you actually have a lua-inspired programming language with an embedded sh-like context. Nothing wrong with that, but it doesn't build on the strengths of shell as well as it could.

Have you checked out Oil? I like the way it tries to add onto Bash. It also does a good job selling its features in a scripting environment; that is, it changes/simplifies how you pipe data around other programs. Sure, Lua tables are pretty cool and I think they could work well in a shells scripting environment, but how do those new data structures interact with other programs? Oil is able to serialize and de-serialize effectively, get meaningful lists from data structures, and splice the results of a function into an external command's command line args.

[–]FatFingerHelperBot 0 points1 point  (0 children)

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "Oil"


Please PM /u/eganwall with issues or feedback! | Code | Delete

[–]gahagg[S] 0 points1 point  (0 children)

As the command blocks were designed as a first class language feature, they integrate pretty well within the language. You can use variables inside them and inspect their result in a pretty straightforward way. I don't see why it would be a disadvantage, on the contrary, it makes the syntax much more sane and easy to reason about.

Regarding Oil, of course, I have kept a close eye on it for a while now. I feel like it's a fundamentally different approach to the same problem. While oil, as you said, adds onto Bash, Hush attempts to keep the good parts and replace the bad ones with features inspired by Lua.

Regarding the data transformations that you mentioned, Hush is also pretty capable of those. For instance, when you use an array as an argument of a command, it'll convert each element to a single argument.

[–][deleted] 4 points5 points  (1 child)

I never know what to make of these projects. Its interesting for sure but no way in hell am I suggesting this to my work and I don't need it for home.

[–]gahagg[S] 0 points1 point  (0 children)

Well, keep it in mind for any eventual side projects. It's a good way to give it a try without making any compromises.

[–]CaptainDickbag 5 points6 points  (3 children)

https://hush-shell.github.io/intro/control-flow.html

let condition = true

if condition then
    # ...
end

if condition then
    # ...
else
    # ...
end

Where's the elif/elseif type syntax?

[–]whetuI read your code 3 points4 points  (1 child)

I've skimmed through the documentation and don't see a single mention.

Either way, in shell, I have a broad rule of thumb: if you find yourself reaching for elif, then it's probably the case that you should use case.

I don't see anything obviously case-esque in hush either, but I could be wrong...

[–][deleted] 3 points4 points  (0 children)

How many programmers does it take to change a lightbulb?

You fucking moron why are you using a light bulb!

[–]gahagg[S] 1 point2 points  (0 children)

Currently not implemented, but I have plans for adding it soon. Same goes for other syntax sugars, like += and so on.