squint

yogthos 2024-11-19T01:18:11.968919Z

got http server working that talks to pg https://github.com/yogthos/squint-http-server

🎉 2
yogthos 2024-11-19T01:18:43.506449Z

@borkdude let me know if you think anything can be improved there, and I can make a pr for examples

yogthos 2024-11-19T01:19:04.746459Z

the whole async thing in js kills me inside 😅

Thomas Cothran 2024-11-26T22:36:28.814119Z

What are the current limitations of protocols in squint? I started adapting a library to work with squint, but I've run into a few issues. Most were relatively minor -- for example, :extend-with-metadata isn't supported, and docstrings can't be included in the protocol's methods. However, it also looks like extend-protocol isn't supported.

borkdude 2024-11-26T22:37:30.704269Z

@tmcothran feel free to post issues about those with repros, then I'll have a look at each one of them

Thomas Cothran 2024-11-26T23:04:22.821329Z

I posted the docstring one to github. I think extend-protocol was the result of trying to extend a type that exists in CLJS but not squint. Testing that theory now

borkdude 2024-11-29T15:56:31.971319Z

@tmcothran extend-protocol to nil is also fixed

m3tti 2024-11-19T11:01:26.764849Z

i like it on the first skim. The fact you are using the basic http server is awesome 😄. I would have thought that you would use something like express or better hapi

m3tti 2024-11-19T11:01:48.834459Z

maybe i'll check hapi how it works in squint cause it looks like a good fit. Its data first

borkdude 2024-11-19T11:02:28.870979Z

@ales.najmann also posted a hono example recently in this channel

borkdude 2024-11-19T11:03:46.492669Z

(not familiar with it, so I can't say I endorse it or not)

yogthos 2024-11-19T13:29:05.902779Z

@mathaeus.peter.sander oh yeah for anything more serious using something like express would probably make sense, in my case I just have a minimal lambda API I'm using this for, so went with the most basic thing available 🙂

👍 1
💯 1
m3tti 2024-11-19T13:29:51.486899Z

I would have done the same

😀 1
littleli 2024-11-19T13:38:10.119969Z

Makes sense. I'd still use Hono even for that since it has uniform APIs for such things (cloudflare workers, cloud functions etc).

yogthos 2024-11-19T13:38:37.589679Z

oh yeah that could be handy

yogthos 2024-11-19T13:38:56.027299Z

my familiarity with the js ecosystem is very minimal

littleli 2024-11-19T13:39:18.383699Z

don't worry, I also do this "only on fridays" kinda 😞

yogthos 2024-11-19T14:01:39.081799Z

I find the async part trips me up the most with js, I'm just not used to thinking in this way and even with using stuff like await I still find there are things that trip you up

yogthos 2024-11-19T14:03:02.614879Z

for example (.-rows (js-await (.query pool query params))) having to do js-await before you can grab rows is easy to miss, and then the errors you get aren't terribly helpful

yogthos 2024-11-19T14:03:28.837259Z

and once you have an async function happening then everything that calls it has to deal with promises, and it's the whole callback hell business 🙂

yogthos 2024-11-19T14:03:41.273499Z

it's not too bad if you can keep this at the edges though

borkdude 2024-11-19T14:04:11.021719Z

@yogthos About the PR, maybe we can just make a link to your repo. All these involved examples increase the maintenance burden for me when something is out of date and I don't like to have to run databases etc just for an example :)

yogthos 2024-11-19T14:04:48.084779Z

oh sure yeah

yogthos 2024-11-19T14:05:02.112309Z

makes sense, testing does get gnarlier this way

borkdude 2024-11-19T14:05:24.190429Z

about promises: https://clojurians.slack.com/archives/C0459PCHLTW/p1731617770606899

😆 7
borkdude 2024-11-19T11:34:08.721509Z

Basic version of https://squint-cljs.github.io/squint/?src=KHJlcXVpcmUgJ1tjbG9qdXJlLnN0cmluZyA6YXMgc3RyXSkKCihkZWZjbGFzcyBSYXdTdHJpbmcKICAoZmllbGQgLXMpCiAgKGNvbnN0cnVjdG9yIFtfIHNdCiAgICAoc2V0ISAtcyAoc3RyIHMpKSkKICBPYmplY3QKICAodG9TdHJpbmcgW19dCiAgICAtcykpCgooZGVmbiAtPmF0dHJzIFttXQogIChpZiAobWFwPyBtKQogICAgKHN0ci9qb2luICIgIgogICAgICAoZm9yIFtbayB2XSBtXQogICAgICAgIChzdHIgKHN0ciBrKSAiPVwiIiAoc3RyIHYpICJcIiIpKSkKICAgIChodG1sIG0pKSkKCihkZWZuIGh0bWwgW3hdCiAgKGlmIChpbnN0YW5jZT8gUmF3U3RyaW5nIHgpIHgKICAgIChsZXQgW3JlcyAoY29uZAogICAgICAgICAgICAgICAgKHZlY3Rvcj8geCkKICAgICAgICAgICAgICAgIChsZXQgW1thdHRycyBjaGlsZHJlbl0gKHJlc3QgeCkKICAgICAgICAgICAgICAgICAgICAgIFthdHRycyBjaGlsZHJlbl0gKGlmIChtYXA%2FIGF0dHJzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFthdHRycyBjaGlsZHJlbl0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbbmlsIChjb25zIGF0dHJzIGNoaWxkcmVuKV0pXQogICAgICAgICAgICAgICAgICAoc3RyCiAgICAgICAgICAgICAgICAgICAgIjwiIChmaXJzdCB4KSAod2hlbiBhdHRycwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoc3RyICIgIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtPmF0dHJzIGF0dHJzKSkpICI%2BIgogICAgICAgICAgICAgICAgICAgIChodG1sIGNoaWxkcmVuKQogICAgICAgICAgICAgICAgICAgICI8LyIgKGZpcnN0IHgpICI%2BIikpCiAgICAgICAgICAgICAgICAoc2VxPyB4KQogICAgICAgICAgICAgICAgKHN0ci9qb2luICIgIiAobWFwIGh0bWwgeCkpCiAgICAgICAgICAgICAgICAobmlsPyB4KSAiIgogICAgICAgICAgICAgICAgOmVsc2UgKHN0ciB4KSldCiAgICAgIChuZXcgUmF3U3RyaW5nIHJlcykpKSkKCihzdHIgKGh0bWwgWzpkaXYgWzphIHs6Y2xhc3MgImR1ZGUifSAxXV0pKQ%3D%3D in squint