25
submitted 2 months ago* (last edited 2 months ago) by ZILtoid1991@lemmy.world to c/programming@programming.dev

Originally, I was going to use D, but its current WASM guideline is buried under a lot of Discord threads, all while people are lazy to touch the wiki. I need to test stuff with WASM (use for scripting in applications, not browsers).

Please NO RUST!!! While I see why functional programming is useful (I even use wasmtime as my WASM engine, which is developed in Rust), but is horribly counterproductive for game development, especially if it's opt out like in Rust.

EDIT: In the meanwhile, I've found AssemblyScript, which seems to be good for my usecase.

you are viewing a single comment's thread
view the rest of the comments
[-] FizzyOrange@programming.dev 2 points 2 months ago

where FP seeks to make most things pure

I made this mistake for ages because Haskell is so popular and it's functional and pure, but it's not actually a requirement for functional languages to be pure. OCaml isn't.

When I read Rust code, I have to completely shift my thinking to something much more imperative.

I agree Rust code has a different feel to OCaml code but that's because it makes some things easier (e.g. mutation, vectors). You still could write Rust as if it was OCaml (except for the lack of currying), it's just that nobody does that because it sucks.

I think we're probably agreeing, it's just that "functional programming" is extremely poorly defined and we're interrupting it differently. You're thinking "a language where people write enormous nested expressions and over-use recursive functions and linked lists" and I'm thinking "a language that supports lots of features common in the FP paradigm: first class functions, pattern matching, expression based not statement based, iterators/map/filter/reduce, currying, tagged unions/sum types, etc."

[-] expr@programming.dev 2 points 2 months ago

I made this mistake for ages because Haskell is so popular and it's functional and pure, but it's not actually a requirement for functional languages to be pure. OCaml isn't.

I didn't say that FP languages have to necessarily be pure, just that FP languages tackle the problem of mutation by arranging programs such that most things are typically pure and side effects typically happen at the periphery (logging is probably the one exception, though). This is true even in FP languages that allow arbitrary side effects in functions, it's just not enforced by a compiler.

I agree Rust code has a different feel to OCaml code but that's because it makes some things easier (e.g. mutation, vectors). You still could write Rust as if it was OCaml (except for the lack of currying), it's just that nobody does that because it sucks.

That's the entire point, though. It's all about what the language emphasizes and makes easy to do. If it's unnatural to write a functional program in Rust and no one does it, then it's not really reasonable to call it a functional language. Writing functional programs is not idiomatic Rust, and that's okay.

this post was submitted on 29 Aug 2024
25 points (79.1% liked)

Programming

17314 readers
255 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS