Fork me on GitHub
#off-topic
<
2023-03-08
>
Mario Trost06:03:49

Interesting read from the founder of Fly. I know that some people here are using it, I used it in my last job so can't say if there were reliability issues the past months https://community.fly.io/t/reliability-its-not-great/11253

mdiin08:03:58

Reading the post and skimming through the comments section, I am so happy to see people replying with support instead of anger. Given the troubles he hints at in the post, I could understand why some might be angry. I’m not a http://Fly.io user, but that honesty and openness is the kind of communication I want from SaaS platforms I use. I hope they can follow through on the improvements promised.

🙌 2
❤️ 2
Gerome09:03:08

<rant>I currently have to work with Swift on iOS for the first time in my life. I'm a JS/TS dev by profession and Clojure is my language of choice. I've never had to deal with a strict OO language like Swift. I mean what the hell? It starts with the fact that I cannot store different types in dictionaries. If I want a data structure that has different types, I need to use a class, an enum or a struct. They all have slightly different rules and behaviors. I chose structs to represent my data since they are immutable. Of course, structs need to be initialized but I have several different types of objects that I want to represent and they share some props but not all. If I don't want one huge struct that has all the optional properties, I need different structs that conform to a protocol. A protocol is like an interface definition and the fun part is that it also has rules and they read like legalese to me. What's going on? I don't want to do anything naughty. I just want to do some data transformations! Why do I have to jump through all these hoops all of a sudden? Here are some of the property requirements for protocols: > If a protocol requires a property to be gettable and settable, that property requirement can’t be fulfilled by a constant stored property or a read-only computed property. If the protocol only requires a property to be gettable, the requirement can be satisfied by any kind of property, and it’s valid for the property to be also settable if this is useful for your own code. I'm not a native speaker of English but I'm not bad at English. If I read this the first time as a beginner I have a knot in my head and a confused look on my face. Why can't simple things be easy? I just want to use data!</rant>

hidethepain 8
🍎 2
raspasov11:03:20

Haha yeah. Playing the Type Lego can be confusing at first. I've done a bit of Swift and after a few weeks you'll get the idea. It's still annoying but at least it's consistent. One thing I brought back to Clojure from Swift (which is a very rare thing to say for most languages) is awareness of when my values can be nil and increase my use when-let et al. (Swift forces you to statically type-check that. You can hack it into not checking, but it won't make it easy.) That can bring both improved safety to your Clojure and better communicate to a future reader that a value can be nil in a specific scope or context. The real hassle is when you have to use an old-school OOP Apple API/Framework that is in Objective-C only.

wevrem14:03:06

I must be old school because I still prefer Obj-C to Swift. And Obj-C was way less finicky about types.

💯 4
Gerome17:03:01

Yeah, but as a beginner I have to say that Obj-C is super cryptic to read.

Gerome16:03:04

I have to admit after some more practice it is getting better.

mauricio.szabo15:03:33

<rant> I hate mutability. A friend of mine made a huge improvement on some code, and he didn't use any kind of mutability, he's not changing anything, etc. But some code, internally, of some framework, is mutating things. And now I'm searching everywhere to find what happened, because it's in JS, which means that we have something like a = b, then c = b.position, then new Range(c, somethingElse), then this range gets passed through a huge number of places until it is finally mutated.... :face_exhaling:

😭 14
dgb2316:03:25

I had some similar issue a year or two ago with a JS library. My code was mostly functional, with a clear place where stuff gets re-assigned. But an underlying library just mutated objects I passed in. Not even for a good reason. It was a data driven visualisation library. So in order to keep my sanity I actually deep copied everything that I had to pass in. I'm not proud of the resulting code but at least I avoided the weird bugs that way.

p-himik16:03:27

In case it might help you - right there in the debugger, it should be possible to wrap an instance of that Range to make it report any changes to its properties. Maybe even with debugger; in there.

p-himik16:03:58

(But it's especially "fun" when JS/Python devs use that functionality for the opposite - to mutate something when you read properties. Real bloody fun to debug when the ground is escaping from under your feet and expanding values in the debugger view makes it behave differently.)

☝️ 2
mauricio.szabo17:03:30

@U2FRKM4TW wow, how do I do that?

p-himik17:03:38

const x = {hello: 'there'}
Object.defineProperty(x, 'hello', {set(v) {debugger;}});
x.hello = 'world'

👀 8
gneissguise17:03:59

At a previous job we used svelte, so the core state was mutated, however we had a couple of very talented front end engineers who pushed the mutations to the far edges using various ES6 techniques for freezing objects, as well as ramda.js for functional style/cat theory programming to wire everything together. It was pretty nice and we had some great tooling for debugging and observability. I've also used redux patterns in the past with react based applications and had quite a bit of success with writing my state system first in redux, then making the front end display logic as dumb and skinny as possible. There's a cool chrome plugin for redux that allows you to rewind and fast-fwd state reducers that made everything a joy to trace.

mauricio.szabo17:03:01

Well, my problem is that I don't control the place where things get mutated, @U2FRKM4TW. In fact, it is even worse than that, because parts of the place that are being mutated reside on WASM facepalm

facepalm 2
mauricio.szabo17:03:26

I though it was some Chrome Debugger magic 😄

p-himik17:03:55

That's my point - you can create an object or get it right after it's created, define descriptors, and then let it roam free. When something mutates it, the debugger will be triggered in the browser. No clue about the WASM part and whether it interferes with that mechanism at all.

👍 2
Martin Půda17:03:07

Hi, is there any cloud platform with Clojure support and a free tier? I'm looking for a replacement for Heroku's free tier.

Ivar Refsdal18:03:37

Not sure exactly what you are looking for, but there is http://fly.io: https://fly.io/docs/about/pricing/#free-allowances

👍 2
Chase22:03:47

https://render.com/ is quite easy but you only get 512mb ram on the free tier and the $7/mo next level up has the same ram so to get more you would have to jump up to the 2gb $25/month tier. So I will probably explore alternatives again but it works fine for hobby projects. You just need a Dockerfile basically. My example is pretty hacky: https://github.com/chase-lambert/clojure-app-template I just need to find a good image that includes clojure and npm to clean it up.

👍 2
skylize15:03:06

Regarding "Clojure support", anything supporting Docker should work, because there exist an https://github.com/Quantisan/docker-clojure. Can't speak for it yet, but I intend to use Google Cloud for the project I'm working on, which definitely has viable free tier offerings with no time limits.

Drew Verlee17:03:48

When i slurp a dot json file I get unexpected feedback in the form of questions marks as we can see here...

(take 5
  (slurp "some.json"))
  ;; => (\� \� \{ \\0 \")
When I try to get feedback on the file like it's format, I'm told it's a csv...
file some.json
some.json: CSV text
I'm confused because it says dot json, in fact if I look at it, it looks like json. My GUI file manager, in properties, says its of type json

p-himik17:03:24

Perhaps it's BOM. Try inspecting the file with a HEX viewer.

teodorlu17:03:57

You could also try looking at the character codes, if the string isn't rendering right.

(map int "abc")
  ;; => (97 98 99)

  (map int (slurp "some.json"))
  ;; => ? 
Strange behavior!

Drew Verlee18:03:54

thanks @U2FRKM4TW @U3X7174KS @U0GTGHX1D maybe it is a bom, that was the issue before, but back then the file command line tool told me it was bom. Ill try reading it as a bom again to be sure.

Drew Verlee19:03:00

yep, i believe the output i was seeing was due to a bom file. will the adventures never end? 🙂

🙃 2
Jo Øivind Gjernes20:03:31

Sometimes there can be issues with utf-16 also. Try playing around with the :encoding argument (slurp f :encoding “UTF-16”)

👍 2
phill23:03:48

Apache Commons IO has a BOMInputStream that can lessen the headache.