|
QuarkJets posted:If you're writing a shell function then you should stop and do something else, I mean that in the biggest way, maybe become a forest ranger or something In retrospect he was right.
|
# ? Apr 5, 2023 18:21 |
|
|
# ? May 25, 2024 14:47 |
|
bash scripts rule, they're a great choice for a ton of things, just don't use them for everything. If it can be done in 40 lines of bash that'll be so much easier to manage than python or something.
|
# ? Apr 5, 2023 18:22 |
|
https://twitter.com/elementnumber46/status/1643613896526184448
|
# ? Apr 5, 2023 18:42 |
|
markdown sucks and I wish to destroy it
|
# ? Apr 5, 2023 19:01 |
|
Hammerite posted:markdown sucks and I wish to destroy it Yeah asciidoc is better in every way. Including in that it's a defined thing.
|
# ? Apr 5, 2023 19:07 |
|
https://twitter.com/zacbowden/status/1643594814120656897
|
# ? Apr 5, 2023 20:05 |
|
Man I can't find this drat string, might as well just sed the whole codebase
|
# ? Apr 5, 2023 20:17 |
|
shellcheck makes shell an infinitely more usable programming language. It's still a weird language that works differently from every other mainstream language these days, but shellcheck catches most of the common ways to write something that doesn't do what you think it's going to do.
|
# ? Apr 5, 2023 21:38 |
|
I'm not suggesting this is necessarily efficient, but I've almost moved entirely to just writing all my 'scripts' in .Net. I have a project template I just spin up. C# is way more pleasant to write in, and you actually have the ability to extend it into something more robust later if you want. Like I said, I'm not defending this as an efficiency play, but it is way more enjoyable to work in then PS / cmd / shell / etc.
|
# ? Apr 5, 2023 21:45 |
|
It is technically possible to write all your shell scripts in R, but if I saw someone did that I'd probably just quit.
|
# ? Apr 5, 2023 21:49 |
|
Like I acknowledge that bash scripts can be awful and terrifying in a lot of respects, but really, I place the blame with literally every other programming language for ceding the "plumbing together a bunch of random garbage with as minimal a notation as possible for the happy path" space to stuff like bash.
|
# ? Apr 5, 2023 21:55 |
|
Minimal notation? Bash scripts generally look like you loaded a shotgun with punctuation and fired it at the screen.
|
# ? Apr 5, 2023 22:59 |
|
Are you thinking of APL?
|
# ? Apr 5, 2023 23:15 |
|
Okay maybe happy path isn't the right words. I mean when your script just does a bunch of stuff maybe with a minimal loop and you don't have to worry about safely passing user input around or handling errors. Sure there's probably a few pipes and stray semicolons, but you're still under budget from not needing most commas and curly braces and parentheses. Like most programming languages aren't interested in competing with how concise curl https://example.org or even curl -sSf https://example.org | jq .lol is, they immediately make you think about stuff like explicitly creating an http client that pools connections, whether you're streaming the response body, what data type represents it, how to handle errors at different layers, etc, which is probably good but it's still slightly inconvenient for me in the moment so whoops here's another 100 lines bash script that started as a 3-commands pipeline that I had to run repeatedly for some reason. I wish there were good languages out there vying for me as a customer specifically. Vanadium fucked around with this message at 23:23 on Apr 5, 2023 |
# ? Apr 5, 2023 23:17 |
owns
|
|
# ? Apr 5, 2023 23:29 |
|
Considered as programming languages, Unix shells are DSLs for running commands. The problem is that they all suck at that, for a couple reasons. The first is that they’re focused on making things really easy to do instead of really easy to do correctly, so they do poo poo like swallow errors by default and muddy lists and strings in ways that programmers have to explicitly protect against. The second is that they’re a very 1970s style of language with a bunch of hyper-terse builtin operations with poor discoverability and frequently odd semantics, and if you need something slightly different, good luck composing it out of what’s there.
|
# ? Apr 6, 2023 01:08 |
|
all shells should work like router command lines where every command, switch, and parameter is fluidly autocompleted and switches can be discovered immediately by typing a question mark
|
# ? Apr 6, 2023 01:15 |
|
rjmccall posted:Considered as programming languages, Unix shells are DSLs for running commands. The problem is that they all suck at that, for a couple reasons. The first is that they’re focused on making things really easy to do instead of really easy to do correctly, so they do poo poo like swallow errors by default and muddy lists and strings in ways that programmers have to explicitly protect against. Yeah, that's right of course. I think these are tradeoffs, shells made lovely tradeoffs because it was a different time, but everybody else doesn't even try to get anywhere near the conciseness of a shell pipeline. Maybe the Haskell people do in isolated cases but it's immediately impossibly convoluted by all the higher order types and that sort of thing. quote:The second is that they’re a very 1970s style of language with a bunch of hyper-terse builtin operations with poor discoverability and frequently odd semantics, and if you need something slightly different, good luck composing it out of what’s there. Ehh, how much discoverability do you need for a shell? Ideally there wouldn't be that much to discover, you'd download a cheatsheet that gives you intuition for basic, common stuff and leaves you with vocabulary to look up fancier stuff in a man page if you can't stackoverflow it for whatever reason. You'd probably use the shell all the time so you'd internalize the important stuff really soon. imo people give terseness too much poo poo. Yeah, nobody wants to read a perl script that got golfed to hell, but, like, assuming for a moment that we're talking about a hypothetical language where people really thought through the fundamental design to encompass basic use cases without being limited by them, having an idiomatic/built-in hyper-terse way to denote the basic table-stakes operations that you do all the time just removes cognitive load. Code is more readable if there's less of it! My ceterum censeo is basically that the perl people were on to something and the PLT people turning their back on them was basically criminally negligent.
|
# ? Apr 6, 2023 02:33 |
|
I mean, the terse things I object to in shells is the crap like all the operators you can do after the variable name in a ${} expansion, which is just unreadable gibberish that only a real sicko would have learned by heart.
|
# ? Apr 6, 2023 02:37 |
|
Okay, yeah, I have to look up unset ${!AWS_*} every time because I refused to type out AWS_SECRET_ACCESS_KEY etc.
|
# ? Apr 6, 2023 02:46 |
|
Kazinsal posted:all shells should work like router command lines where every command, switch, and parameter is fluidly autocompleted and switches can be discovered immediately by typing a question mark fish has best autocomplete, just smash tab and auto complete practically everything
|
# ? Apr 6, 2023 03:30 |
|
Vanadium posted:Okay, yeah, I have to look up unset ${!AWS_*} every time because I refused to type out AWS_SECRET_ACCESS_KEY etc. Go directly to jail
|
# ? Apr 6, 2023 06:39 |
|
There'd be a lot more programming languages used as shell scripts if you could execute them from the command-line like Python. Just replace Powershell with "dotnet myscript.cs" already.
|
# ? Apr 6, 2023 06:57 |
|
I've got to admit the new c# syntax where you can just leave out the main method has me doing this
|
# ? Apr 6, 2023 09:01 |
|
Canine Blues Arooo posted:I'm not suggesting this is necessarily efficient, but I've almost moved entirely to just writing all my 'scripts' in .Net. I have a project template I just spin up. C# is way more pleasant to write in, and you actually have the ability to extend it into something more robust later if you want. Not sure if it would help with this or not but I found a decent c# REPL I've been playing with very recently. I haven't bothered with c# REPLs in the past but this one seems pretty good. There's also dotnet-script but I've never used it. I've also replaced some hairy scripts with c# utilities but I stopped during the early .net core releases where things just kept changing a lot. Now that things are relatively stable I may do it again though.
|
# ? Apr 6, 2023 15:42 |
|
i wrote a pure posix sh csv parser once, just to prove i could do it
|
# ? Apr 11, 2023 05:00 |
|
DELETE CASCADE posted:i wrote a pure posix sh csv parser once, just to prove i could do it I wrote a (toy) lisp interpreter in smalltalk once but you don't see me braggin Actually, yeah you do, that kicked rear end
|
# ? Apr 11, 2023 05:07 |
|
The real horror is letting this thread die due to inactivity.
|
# ? Jun 4, 2023 23:20 |
|
Sorry but I think we fixed software development, all of the code is good now
|
# ? Jun 4, 2023 23:28 |
|
Volmarias posted:The real horror is letting this thread die due to inactivity. This post could have been an email.
|
# ? Jun 4, 2023 23:46 |
|
QuarkJets posted:Sorry but I think we fixed software development, all of the code is good now Does that mean my repositories have been properly purged with cleansing fire? Because I don't know what else could fix them.
|
# ? Jun 5, 2023 02:15 |
|
We had the tabs vs spaces argument at work.
|
# ? Jun 5, 2023 03:48 |
|
did you win
|
# ? Jun 5, 2023 04:13 |
|
I stayed well away.
|
# ? Jun 5, 2023 05:40 |
|
I would blow Dane Cook posted:I stayed well away.
|
# ? Jun 5, 2023 07:07 |
|
QuarkJets posted:Sorry but I think we fixed software development, all of the code is good now I'm still employed so this is unfortunately not true.
|
# ? Jun 5, 2023 08:06 |
|
I went into a video call expecting a tabs vs spaces discussion when I raised the issue of the baffling seemingly random C code style on a project I'm working on. Sometimes there would be a space between the function name and arglist, sometimes where wouldn't. There are occasional superfluous space after an open brace, which my emacs setups paints in angry red, that I would have to sweep up using whitespace-cleanup before commits. It turned out every extra space has it's purpose and it is beautiful. `foo ()` vs `foo()` allows grep to distinguish between definitions and call sites. The superfluous space is a marker for a codegen tool that inserts markers for code coverage testing using gcov.
|
# ? Jun 5, 2023 10:03 |
|
Beef posted:I went into a video call expecting a tabs vs spaces discussion when I raised the issue of the baffling seemingly random C code style on a project I'm working on. Sometimes there would be a space between the function name and arglist, sometimes where wouldn't. There are occasional superfluous space after an open brace, which my emacs setups paints in angry red, that I would have to sweep up using whitespace-cleanup before commits. Definitely the right thread for this post. Beauty is in the eyes of a beholder.
|
# ? Jun 5, 2023 12:38 |
|
I'm still afraid to ask why there's an extra space in front of semicolons.
|
# ? Jun 5, 2023 14:06 |
|
|
# ? May 25, 2024 14:47 |
|
Beef posted:I'm still afraid to ask why there's an extra space in front of semicolons. They said. It's for an out-of-band code generator.
|
# ? Jun 5, 2023 15:00 |