News for hackers. Stuff that matters.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by enriquto on Tuesday October 05, 2021 @09:21AM (#28759036)
This is seriously cool, and I would use it frequently... if only there was a rust compiler in my computer.

Since it is a somewhat "thin" wrapper around curl, are there deep reasons for it to be written in Rust as opposed to, say, C or posix shell? Was learning Rust one of the main goals of this project? (not that there would be anything wrong with that, just asking).

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by ReactiveJelly on Tuesday October 05, 2021 @09:27AM (#28759127)
https://hurl.dev/docs/installation.html

> Precompiled binary is available at hurl-1.3.1-x86_64-linux.tar.gz

https://github.com/Orange-OpenSource/hurl/releases/download/...

> For Debian / Ubuntu, Hurl can be installed using a binary .deb file provided in each Hurl release.

> hurl-bin package for Arch Linux and derived distros.

> An installer is available at hurl-1.3.1-win64-installer.exe

Just glancing at a few files, main.rs is already over 500 lines, which means shell would be impractical. C is a very difficult language to learn and to use correctly, so in the long-term there will be more Rust (and Go, and Python) programmers than C programmers. I think that is a good reason for projects to choose other languages.

In fact, one might equally ask why it wasn't written in Python - Python is safer than C, far easier, and performance doesn't sound critical for an HTTP debugger meant to be used interactively by a human.

We're probably already far past the point of "There are more competent Python programmers than competent C programmers."

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by jicea on Tuesday October 05, 2021 @10:05AM (#28759658)
As a matter of fact, our first implementation of Hurl was written in Python. We switch to Rust because:

- we're a 30 developper team with Linux, Windows and macOs computers. Installing Hurl with Python on Windows boxes was always a challenge and the single drop Rust binary has been a relief for us,

- in a CI, we really want to run tests as fast as possible. The Rust version (the actual one) seems a lot faster that our Python prototype (certainly due to our lack of optimisation in our Python code)

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by Fiahil on Tuesday October 05, 2021 @10:34AM (#28760040)
Good choice, Rust is much better than python for concurrency, and that might be of interest in a future release :)
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by lpcvoid on Tuesday October 05, 2021 @09:50AM (#28759465)
>We're probably already far past the point of "There are more competent Python programmers than competent C programmers."

Maybe this is the point where we need to start thinking about where we went wrong? I know that nobody cares about performance anymore, but if anybody is really thinking about Python as a replacement for C then that makes me sad.

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by DandyDev on Tuesday October 05, 2021 @10:31AM (#28759989)
I don't think the claim is that Python is a good replacement for C. But there are probably more (business) problems for which Python is the right tool to solve it then problems for which C is the right tool.

C is also a lot harder than Python to learn.

So for these reasons there are more Python programmers than C programmers.

For some subset of problems for which C is a good tool, Rust is a good alternative, arguably with less foot guns. For some other problems that are solved with C, Golang is a good alternative.

So in the end C is losing marketshare because of all these reasons.

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by nicoburns on Tuesday October 05, 2021 @11:14AM (#28760553)
I think the success of Go and Rust show that lots of people care about performance. But it has to come second to correctness and safety/security, and C makes achieving those things very difficult compared to other languages.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by nicoburns on Tuesday October 05, 2021 @09:42AM (#28759354)
Others have already commented that you don't need a rust compiler for this. But it's also worth noting that compiling Rust programs is typically much more straightforward than compiling C programs, even if you account for installing the Rust compiler as part of the process.

The process would be:

- Run the `curl | bash` command from https://rustup.rs/ to install rust via rustup

- If you have a non-standard shell configuration that rustup can't detect, then add `~/.cargo/bin` to your PATH.

- Clone the git repository containing the program you wish to compile

- Run `cargo build --release` in the source directory.

That's it, and that will work across all major platforms and almost all Rust programs.

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by enriquto on Tuesday October 05, 2021 @10:04AM (#28759646)

    rustup: unrecognized OS type: OpenBSD
EDIT: googling around, it seems to be possible to build rust programs for openbsd, but it does not really work "out of the box". May try to install it this weekend.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by nicoburns on Tuesday October 05, 2021 @10:27AM (#28759949)
Ah, OpenBSD looks like a bit of an exception in terms of platform support. FreeBSD and NetBSD both have Tier 2 (which is really the minimum level you want for a compiler host platform), but not OpenBSD.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by fabricereix on Tuesday October 05, 2021 @09:45AM (#28759395)
You don't need a Rust compiler as prebuilt binaries are available for your system. https://hurl.dev/docs/installation.html

Relating to the choice of Rust, we think that it is the best language for this type of command-line tool. Performant like C/C++, but way safer to develop. And using native existing libs such as libcurl is possible.

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by ironmagma on Tuesday October 05, 2021 @09:25AM (#28759093)
Is a Rust compiler really needed? They say there are precompiled binaries available and the package is on several package managers.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by elsombrero on Tuesday October 05, 2021 @09:26AM (#28759111)
In the installation page they just say to download the prebuilt binaries for your system, no need to compile it your self