7 ms·
I would love to have a scripting language has typed features and you can replace bash with. What comes close is: #! /usr/bin/env elixir Mix.install([
by dev_l1x_be 9mo ago
I would love to have a scripting language has typed features and you can replace bash with.
What comes close is:
#! /usr/bin/env elixir
Mix.install([:jason])
defmodule JsonPrettyPrinter do
def get_stdin_data do
:stdio
|> IO.read(:all)
|> Jason.decode()
|> case do
{:ok, json_data} -> json_data
_ -> raise "Invalid JSON payload was provided"
end
end
end
JsonPrettyPrinter.get_stdin_data()
|> JsonPrettyPrinter.pretty_print_json()
|> IO.puts()
- PaulHoule 9mo agoTwo interesting options for everyday scripting are Python and Powershell.
- b40d-48b2-979e 9mo agoA nice part of PowerShell: you can `Add-Type` and embed C#/F# when you want.
- logicallee 9mo agoyou won't believe how powerful Python is with libraries. ChatGPT and Claude made a brand new browser, that isn't based on Chromium or Firefox, and yet still follows many aspects of layout correctly. I read the article we're discussing ("stop designing languages") on this browser and I'm currently using it to post this reply.
- F3nd0 9mo agoKnowing that LLM’s have been extensively trained on public code, I wonder how much of it is based on Chromium or Firefox.
- logicallee 9mo agoThat's a good question! You can read through the entire source code for the latest version: https://taonexus.com/publicfiles/jan2026/171toy-browser.py.txt https://taonexus.com/publicfiles/jan2026/171toy-browser.py.t... it doesn't look like it would be easily derived from Chromium or Firefox, because this code is Python and those don't use Python this way. By the way is there any feature you'd like to see added to the toy browser? The goal is that one day it's a replacement for Chrome, Firefox, etc. It's being built by ChatGPT and Claude at the moment. Let me know if there are any feature ideas you have that would be cool to add.
- PaulHoule 9mo agoA python-based browser? What are you using for the GUI toolkit?
- logicallee 9mo ago>A python-based browser? What are you using for the GUI toolkit? Great questions. 1. Yes, for the moment. Like the title of this article suggests - we're using a library! :) It's great to iterate in Python, which has a large ecosystem of libraries. Believe it or not, there is a chance that in the future it would be able to translate the language into a different one (for example, C++) while using C++ bindings for the same gui libraries. This would speed up its actions by 40x. However, not all of the libraries used have C++ bindings so it could be harder than it looks. 2. Here's the current version of the source code: https://taonexus.com/publicfiles/jan2026/171toy-browser.py.txt https://taonexus.com/publicfiles/jan2026/171toy-browser.py.t... you can have a quick read through. Originally it was using tkinter for the GUI toolkit. I believe it is still using tkinter, but the AI might be leaning on some other library. As you read it, is it using anything but tkinter for the GUI toolkit? These libraries are doing a lot of heavy lifting, but I think it is still ending up drawing in tkinter (not handing off rendering to any other library.)
- IshKebab 9mo agoPython is actually kind of awkward for this use case since you can't import from other files easily unless you are in a proper Python package, which isn't usually the case for everyday scripting.
- ActorNightly 9mo agoLol what. Python lets you dynamically import from anywhere. The syntax is a bit funky, but thats what llms are for.
- IshKebab 9mo agoNo it doesn't. You can't do something like `import ../../foo/bar`. You can mess around with PYTHONPATH and importlib to work around that but that's a horrible hack that also breaks all tooling. Not a good idea. With Deno you can just import by relative file path and it just works like you'd expect and the tools support it. I wish more languages worked like that.
- Jtsummers 9mo ago> You can't do something like `import ../../foo/bar`. https://docs.python.org/3/reference/import.html#relativeimports https://docs.python.org/3/reference/import.html#relativeimpo... You'd use: import ...foo.bar
- IshKebab 9mo agoCommon misconception. That doesn't import by relative file path; it imports by relative package path. It's actually quite different. Scripts you run directly aren't in a package so you can't use it at all. You can go above the package root. Namespace packages mean it can jump to other directories. Everyone wants that to just mean "import relative to this file" but it doesn't.
- ActorNightly 9mo ago>You can mess around with PYTHONPATH and importlib to work around that but that's a horrible hack that also breaks all tooling ....no. import keyword uses importlib under the hood. It just does a lot of things for you like setting up namespace. But importlib has all the functionality to add the code in any python file cleanly. My custom agent that I use basically has the functionality to wrap every piece of code it writes as a tool and stores it into python files. During tool calls, it pretty much dynamically imports that code as part of a module within the project. Works perfectly fine.
- bashkiddie 9mo agoI am unhappy with python. It degrades fast. It deprecates libraries every minor release and that tends to break the applications I use. Recent examples are distutils and opsaudio.
- ActorNightly 9mo agoThats why venv exists. Much better solution than lock files.
- hashhar 9mo agoDoesn't help much because even the standard library bitrots after enough Python releases. I have things I write today but can't run on a NAS that has older Python. No issues like that with Powershell for example.
- ActorNightly 9mo agoI dunno what issues you are running into, but generally, code from old Python should work fine under new releases if you are developing, you just have to set up your venv right up front and install the specific version of libraries that don't have modern Python code. I still work on projects that were written under 3.6. If you care enough, you can also use something like asdf to install an older Python alongside the system one.
- kelnos 9mo agoFor everyday scripting -- the types of things where I'd be writing in bash but get frustrated with it and switch to python -- I nearly always only need what's in the stdlib. Sure, for "applications", the ecosystem can be frustrating at times, but I don't think that's what we're talking about here.
- qrobit 9mo agoI wanted to say Haskell with shh[^1] and stack's or nix's shebangs[^2][^3], but interpreted haskell is not particularly fast. Also I think a Python script is reasonable if you use a type-checker with full type annotations, although they are not a silver bullet. For most scripts I use fish, which is my preferred interactive shell too. [1]: https://hackage.haskell.org/package/shh https://hackage.haskell.org/package/shh [2]: https://docs.haskellstack.org/en/v3.9.1/topics/scripts/ https://docs.haskellstack.org/en/v3.9.1/topics/scripts/ [3]: https://wiki.nixos.org/wiki/Nix-shell_shebang https://wiki.nixos.org/wiki/Nix-shell_shebang. On a side note, if you were to use nix's shebang for haskell scripts with dependencies, you should be using https://github.com/tomberek/- https://github.com/tomberek/- instead of impure inputs, because it allows for cached evaluation. I personally cloned the repo to my personal gitlab account, since it's small and should never change
- librasteve 9mo agoSuggest you take a look at https://raku.org https://raku.org for a strongly (but gradual) typed scripting language.
- dnautics 9mo agothat's just perl with a new coat of paint
- fn-mote 9mo agoPerl 5 does not have types, as far as I know. I’m taking the GP seriously instead of dismissing it. Raku looks like more fun than nushell tbh.
- librasteve 9mo agoRaku types are a bit thicker than paint https://gist.github.com/raiph/849a4a9d8875542fb86df2b2eda89296 https://gist.github.com/raiph/849a4a9d8875542fb86df2b2eda892...
- dnautics 9mo agoprint 42 + 99; # 141 print &print.file ; # ...src/core.c/io_operators.rakumod print &infix:<+>.file; # ...src/core.c/Numeric.rakumod print ?CORE::<&print>; # True I barely understood these four example lines.
- rurban 9mo agoIt has. They are just poorly supported and disliked.
- librasteve 9mo agowell waiting for Raku (formerly perl6) to be built was like watching paint dry
- DonHopkins 9mo ago
- jakkos 9mo agoHave you seen nushell? It lets me one-liner so many things that would have previously taken breaking out a "real" language to do Contrived example: ls | where type == 'file' | sort-by size | take 4 | each {|f| {n: $f.name, s: ($f.size | format filesize MB) }} | to json outputs { "n": "clippy.toml", "s": "0.000001 MB" }, { "n": "README.md", "s": "0.000009 MB" }, { "n": "rustfmt.toml", "s": "0.000052 MB" }, { "n": "typos.toml", "s": "0.00009 MB" }
- fainpul 9mo agoIn PowerShell: gci -file | sort-object size | select name, size -first 4 | % { $_.size /= 1MB; $_ } | ConvertTo-Json
- NSPG911 9mo agoi dont think you need to select name and size, you can just remove it and use `select -first 4`, but cool, I never knew about `/=` syntax
- fainpul 9mo agoI was trying to replicate the nushell example, which only has name and size in the output.
- xigoi 9mo agoConvertTo-Json? What kind of naming convention is that, especially with all the other commands being lowercase?
- fainpul 9mo agoThe naming convention is `verb-noun`. It's convenient for discoverability and consistency. The short commands are aliases. The last command is properly cased, because I pressed tab (it auto-completes and fixes the case). The other commands I typed without tab completion. You can write however you want, PS is not case sensitive.
- leonidasv 9mo agoThere's a trick shared here days ago to add a kind of shebang to Go that may interest you: https://lorentz.app/blog-item.html?id=go-shebang https://lorentz.app/blog-item.html?id=go-shebang Discussion: https://news.ycombinator.com/item?id=46431028 https://news.ycombinator.com/item?id=46431028
- ashton314 9mo agoIf you just wait a few months, then that program will be written in a typed language. The type checker for Elixir is coming along nicely and every release brings more checks.
- frou_dh 9mo agoOCaml is a scripting language in this sense. No need to compile an executable ahead of time, just have a `#!/usr/bin/env ocaml` shebang (or more realistically: `#!/usr/bin/env -S ocaml -I +unix unix.cma`) at the top of a source file. Though, I don't think it has the capability for single-file scripts to declare 3rd-party dependencies to be automatically installed.
- IshKebab 9mo agoIt also has poor support for Windows. The best option I've found for this use case (ad-hoc scripting with third party dependencies) is Deno. I'm hoping Rust will get there in the end too.
- unpigged 9mo agoBabashka (https://babashka.org/ https://babashka.org/) is an interesting tool for scripting. It's Clojure, so dynamic typing, but it's data orientation makes it a great fit for something like your example.
- DonHopkins 9mo ago@dev_l1x_be: The answer isn't a new typed scripting language. It's recognizing what the interpreter already is. LLMs are eval(). Skills are programs. YAML is the motherboard. @unkulunkulu nails it -- "library as the final language", languages all the way down. Exactly. Skills ARE languages. They teach the interpreter what to understand. When the interpreter understands intent, the distinction dissolves. @conartist6: "DSL is fuzzy... languages and libraries don't have to be opposing" -- yes. Traditional DSL: parse -> AST -> evaluate. LLM "DSL": read intent -> understand -> act. All one step. You can code-switch mid-sentence and it doesn't care. The problem with opinionated frameworks like ROR and their BDFLs like DHH is that one opinion is the WRONG number! The key insight nobody's mentioned: SPEED OF LIGHT vs CARRIER PIGEON. Carrier pigeon: call LLM, get response, parse it, call LLM again, repeat. Slow. Noisy. Every round-trip destroys precision through tokenization. Speed of light: ONE call. I ran 33 turns of Stoner Fluxx -- 10 characters, many opinions, game state, hands, rules, dialogue, jokes -- in a single LLM invocation. The LLM simulates internally at the speed of thought. No serialization overhead. No context-destroying round trips. @jakkos, @PaulHoule: nushell and Python are fine. But you're still writing syntax for a parser. What if you wrote intent for an understander? Bash is a tragedy -- quoting footguns, jq gymnastics, write-only syntax. Our pattern: write intent in YAML, let the LLM "uplift" to clean Python when you need real code. Postel's Law as type system: liberal in what you accept. Semantic understanding catches nonsense because it knows what you MEANT, not just what you TYPED. Proof and philosophy: https://github.com/SimHacker/moollm/blob/main/designs/stanza-notes.md https://github.com/SimHacker/moollm/blob/main/designs/stanza...
- never_inline 9mo agoHoly slop!
- DonHopkins 9mo ago[dead]
- never_inline 9mo ago> LLMs are eval(). Skills are programs. YAML is the motherboard. This for some reason irritated me so much I wrote the comment.
- Pet_Ant 9mo agoHave you considered PowerShell? It's open-source, and typed, and definitely usable from the command line with lots of resources for. https://github.com/PowerShell/PowerShell https://github.com/PowerShell/PowerShell
- fmorel 9mo agoAnd dotnet run can now run single files of C# code, with the ability to import other projects and packages if needed. #!/usr/bin/dotnet run https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-app/ https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-... https://andrewlock.net/exploring-dotnet-10-preview-features-1-exploring-the-dotnet-run-app.cs/ https://andrewlock.net/exploring-dotnet-10-preview-features-...
- melagonster 9mo agoIt probably is perl or Python.
- jeroenhd 9mo agoYou can use various programming languages with shebangs. C#: https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-app/ https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-... Java: https://dev.to/toliyansky/scripting-with-java-3i9k https://dev.to/toliyansky/scripting-with-java-3i9k Go: https://golangcookbook.com/chapters/running/shebang/ https://golangcookbook.com/chapters/running/shebang/ https://github.com/igor-petruk/scriptisto https://github.com/igor-petruk/scriptisto will let you generate shebang scripts for pretty much any language