News for hackers. Stuff that matters.
Re:Is your programming language unreasonable? (2015) by rishav_sharan on Saturday October 10, 2020 @08:16AM (#24738422)
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

Re:Is your programming language unreasonable? (2015) by isaacabraham79 on Saturday October 10, 2020 @09:09AM (#24738734)
Yep, 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.

Re:Is your programming language unreasonable? (2015) by retendo on Saturday October 10, 2020 @08:26AM (#24738484)
Could you go into a little more detail what task you were trying to solve?
Re:Is your programming language unreasonable? (2015) by rishav_sharan on Saturday October 10, 2020 @08:57AM (#24738656)
Its 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

Re:Is your programming language unreasonable? (2015) by rtlfe on Saturday October 10, 2020 @09:05AM (#24738706)
> 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

Re:Is your programming language unreasonable? (2015) by rishav_sharan on Saturday October 10, 2020 @10:44AM (#24739315)
Needed to get that by entity id, so its a Hash.