top | item 30488030

Req – An HTTP Scripting Language

91 points| elvis70 | 4 years ago |andrewpillar.com | reply

34 comments

order
[+] nikeee|4 years ago|reply
I recently discovered Hurl, which has a similar idea and I think it's great for API integration tests:

https://hurl.dev

[+] donatj|4 years ago|reply
I'd be very interested in using this as an embeddable language in a couple of my Go projects.

Glancing at the code, seems easy enough.

If the Author is around, I'm curious if that'd be a supported use case? The README makes no note.

[+] earthboundkid|4 years ago|reply
I saw this on Reddit a couple of days ago. Two suggestions:

- Change the symbol -> to | because it's more similar to how pipe works in shell than how -> works in C++/PHP.

- Introduce a second way to do string literals, so :hello is equivalent to "hello". Then change encode so that its second argument is a string instead of a mysterious name. (Read the docs but didn't actually understand how it worked under the hood. Is it just hardcoded?) So `encode json` becomes `encode :json` (or `encode "json"` if the user prefers).

This is a pretty cool project.

[+] jamescun|4 years ago|reply
Great idea! I have a similar, long forgotten, idea in the projects folder also called "req". Look forward to seeing this develop!
[+] alexk307|4 years ago|reply
Nice project, but this is not super useful in practice. HTTP itself is a DSL, so this is another DSL around that DSL. I would definitely choose curl and bash over any other abstraction, and if logic was needed, there are great libraries in every language to do this - requests in Python for example. Sounds like a good learning experience though!
[+] t43562|4 years ago|reply
I just started to learn about "Mule" - this makes me think of the language it offers to work with APIs (dataweave) - one might want to be able to have a way for this language to be extended to allow web serving so that one could use it as a way to build new simpler APIs from lower level ones.
[+] bryanrasmussen|4 years ago|reply
[+] kbd|4 years ago|reply
Oh man, REBOL, blast from the past. If they had open-sourced it early instead of trying to promote a proprietary programming language we might talk about REBOL along with Python and Ruby. Instead, it's forgotten.
[+] kburman|4 years ago|reply
Why not use python/ruby?
[+] seanw444|4 years ago|reply
The author said he wanted to build something that incorporated the things he learned while going through some "How to build a compiler in Go" books, not necessarily for anything particularly useful.
[+] chris37879|4 years ago|reply
Python and ruby wouldn't exist if more people asked that question. Not all code needs to be a product intended for use.
[+] donatj|4 years ago|reply
I'd say the lack of need of a particular interpreter makes this a lot more portable and usable.

A tool written in Python or Ruby will always be most usable by Python or Ruby developers. A tool written in Go and compiled to a single binary has no such barrier to entry.

[+] ushakov|4 years ago|reply
it’s a neat idea, but useless in a form of a programming language

during the pandemic i have started building a declarative (YAML) http client for testing APIs which will integrate into CI/CD like GitHub

drop me a line if you’re interested

[+] linkdd|4 years ago|reply
not particularly interested, but highly curious to what is a "declarative client".
[+] unfocussed_mike|4 years ago|reply
I would like to read this, but unfortunately my eyes are in their late forties even if my brain is only 25.

Very occasionally I bump up the font size a notch in Chrome to make things a little easier when I am tired. Even HN occasionally.

I've not had to bump it up _three_ notches before now. 12px serif body text in 2022? Ouch :-/

[+] OJFord|4 years ago|reply
Looks great to me, I zoom out twice (80%) by default, often going a third (67%) per site; this looks nice to me at 100%.

I'll get there one day I suppose and should enjoy it while it lasts, but for now most stuff really does look comically large and content-less.

[+] IceWreck|4 years ago|reply
I had to zoom it to 200% to read on my laptop.
[+] nojonestownpls|4 years ago|reply
Reader Mode in Firefox is a godsend for this. Instead of click after click on the Zoom+ button (or Ctrl-+), trying to see how many it takes, it's a single click to immediately get things into exactly the font, width, and colour I want.
[+] donatj|4 years ago|reply
>12px serif body text in 2022

Hacker News, and in fact this comment are 12px. Something's up with this site that's making it extra tiny.

Update: Proof - https://jdon.at/ZVirr2

[+] rmbyrro|4 years ago|reply
Yep, 200% zoom needed here
[+] xboxnolifes|4 years ago|reply
Oh no, you had to use a feature of your browser for it's intended use-case.
[+] Garlef|4 years ago|reply
Sidenote: The font is very small on this site.
[+] spicybright|4 years ago|reply
Was going to say. 12px is way too tiny.