Req – An HTTP Scripting Language(andrewpillar.com)
andrewpillar.com
Req – An HTTP Scripting Language
https://andrewpillar.com/programming/2022/02/26/req-an-http-scripting-language/
34 comments
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.
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.
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.
- 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.
Great idea! I have a similar, long forgotten, idea in the projects folder also called "req". Look forward to seeing this develop!
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!
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.
JSON and Rebol https://ross-gill.com/page/JSON_and_REBOL
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.
There has been an open source successor to REBOL called Red[1] for years but progress seems to have been pretty sporadic.
[1] https://www.red-lang.org/
[1] https://www.red-lang.org/
Why not use python/ruby?
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.
Python and ruby wouldn't exist if more people asked that question. Not all code needs to be a product intended for use.
Can you clarify? Do you mean python/ruby wouldn't exist if people asked why not use an established language?
Always happy to clarify something I was vague about.
I get asking that question when you're talking about lesser known tech, but when someone writes an entire language themselves, it's a bit disingenuous to think they don't know about two of the largest languages on the planet. It'd be more reasonable to ask "What advantages does this have over the standard library in python or ruby?". A similar question would be looking at ruby or python and wondering why you should use those when perfectly good ANSI C exists.
As to the second part of my statement, I hope that's fairly obvious, but I'll lay it out explicity: Not all code needs to be a product vying for market share to be useful. Some code is for the author to learn from, some code is for making art, some code is for shits and giggles to throw into the world on a lark because someone else might do something with it, or learn something from it, or use it to solve that _exact_ bug they've been having in something just cause they see you did something similar a different way.
I get asking that question when you're talking about lesser known tech, but when someone writes an entire language themselves, it's a bit disingenuous to think they don't know about two of the largest languages on the planet. It'd be more reasonable to ask "What advantages does this have over the standard library in python or ruby?". A similar question would be looking at ruby or python and wondering why you should use those when perfectly good ANSI C exists.
As to the second part of my statement, I hope that's fairly obvious, but I'll lay it out explicity: Not all code needs to be a product vying for market share to be useful. Some code is for the author to learn from, some code is for making art, some code is for shits and giggles to throw into the world on a lark because someone else might do something with it, or learn something from it, or use it to solve that _exact_ bug they've been having in something just cause they see you did something similar a different way.
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.
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.
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
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
not particularly interested, but highly curious to what is a "declarative client".
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 :-/
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 :-/
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.
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.
I had to zoom it to 200% to read on my laptop.
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.
Yeah -- I use Safari's reader mode on the iPad a lot. But I have muscle memory for page-zoom on desktop!
>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
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
Good spot.
Though this comment is not 12px Serif, it is 12px sans-serif (and Verdana at that). Which makes a really significant difference with small fonts.
It's also not body text on a blog article; this size of text is really too small for long-form reading (which admittedly includes all of my bloviating HN comments, natch)
Though this comment is not 12px Serif, it is 12px sans-serif (and Verdana at that). Which makes a really significant difference with small fonts.
It's also not body text on a blog article; this size of text is really too small for long-form reading (which admittedly includes all of my bloviating HN comments, natch)
It's sans-serif, hence the difference.
What's extremely interesting is that on my laptop, HN is 12px when Firefox is full screen, but 13.33px when Firefox only uses the left or right half of my screen.
What's extremely interesting is that on my laptop, HN is 12px when Firefox is full screen, but 13.33px when Firefox only uses the left or right half of my screen.
> What's extremely interesting is that on my laptop, HN is 12px when Firefox is full screen, but 13.33px when Firefox only uses the left or right half of my screen.
Yeah -- this is a common strategy for mobile rendering which on the face of it seems quite counterintuitive, but actually isn't.
Yeah -- this is a common strategy for mobile rendering which on the face of it seems quite counterintuitive, but actually isn't.
That seems so obvious, now that you said it. Thanks for sharing :)
Yep, 200% zoom needed here
Oh no, you had to use a feature of your browser for it's intended use-case.
Please don't be a jerk in HN comments. It's not what this site is for, and it destroys what it is for.
https://news.ycombinator.com/newsguidelines.html
https://news.ycombinator.com/newsguidelines.html
Sidenote: The font is very small on this site.
Was going to say. 12px is way too tiny.
On my Mac in FF, HN is 9pt, which ends up being 12px, but it does look larger than the Req site... Oh browsers...
Verdana (which is what HN uses at least for me) is a much wider font, though.
The website uses Fira Sans, which is very condensed (as much as you can without having to stretch the characters, in fact).
You can see that the code snippets on the website "look" much larger even though they're also 12px, since they are set in Courier New.
The website uses Fira Sans, which is very condensed (as much as you can without having to stretch the characters, in fact).
You can see that the code snippets on the website "look" much larger even though they're also 12px, since they are set in Courier New.
https://hurl.dev