News for hackers. Stuff that matters.
Re:Shell Scripting with Elixir by thibaut_barrere on Tuesday February 13, 2024 @05:35AM (#39356380)
If your script needs to do things like reliable HTTP querying and JSON parsing, I would say using Elixir (once you get used to it) won’t be harmful in any way, quite the contrary.

Interestingly, what drove me to Ruby initially is exactly writing scripting tasks in a C#/C++ culture where Ruby would have been considered harmful.

Now Elixir can be used for the same type of tasks, but only better (eg: trivial parallelized downloads!)

Re:Shell Scripting with Elixir by neonsunset on Tuesday February 13, 2024 @05:48AM (#39356470)
F# and C# are very different to C++ in this regard.

Parallel downloads in C# boil down to

    using var http = new HttpClient();

    var urls = new[]
    {
        "http://example.com/file1.jpg",
        "http://example.com/file2.jpg",
        /* ... */
    };
    var files = await Task.WhenAll(
        urls.Select(http.GetByteArrayAsync));
(you can replace '.GetByteArrayAsync' with .GetFromJsonAsync, .GetStreamAsync and more depending on your needs and e.g. forward the incoming data directly to files on the disk or another source)