4 ms·
A bit of a tangent, but I tried F# recently to make a small gamedev framework. I absolutely adored the language at first. Loved the syntax. loved the type defin
by rishav_sharan 6y ago
A bit of a tangent, but I tried F# recently to make a small gamedev framework. I absolutely adored the language at first. Loved the syntax. loved the type definitions and domain modeling. I felt maybe, this is it, this is the language for me. Never felt that way about a language since the last time I wrote something in Crystal.
Then came the part where I needed to work with list of records and realized that something as basic as that which I take for granted in other languages, is a monstrously complicated concept in f#. I got introduced to the shady world of Lenses, tried my hand for a bit and decided to get out. Lenses are not for me.
I can't believe that a language makes updating records so difficult. F# is my first functional language and while I expected some friction in doing such stuff in a functional language, I never expected so much work around something so trivial.
But is does helps me understand why people don't use F# for things like gamedev.
Anyway TLDR; love the language. Wish that it will make concepts like Lens much easier to use in the language
- retendo 6y agoCould you go into a little more detail what task you were trying to solve?
- rishav_sharan 6y agoIts been a while, so I might be saying it wrong but, I was trying to create an entity collection. Essentially, a super basic scene graph. on every tick in my update call, i would update something about a specific entity in that collection (maybe position, transform etc). And then in my draw call I would render the entire updated collection. Just getting a specific entity from the list was a huge issue and then updating it and putting it back was worse. I gave up after a many days of trying something as basic as this. In JS, Nim, Crystal etc. this would have taken me a couple of lines of code. Here I ended up reading bid docs on something called Lens and was never able to apply it correctly. here is the repo i was working on https://github.com/rishavs/coral/blob/master/Engine.fs https://github.com/rishavs/coral/blob/master/Engine.fs
- rtlfe 6y ago> Just getting a specific entity from the list was a huge issue and then updating it and putting it back was worse. I must be missing something, but this sounds like a pretty straightforward List.map
- rishav_sharan 6y agoNeeded to get that by entity id, so its a Hash.
- deleted 6y ago[deleted]
- isaacabraham79 6y agoYep, this is definitely something that should be made easier and there's an RFC to address it. There are also some libraries out there that make this easier. I'd say it's an annoyance and should be improved, but it's nowhere near a blocker for us.