8 ms·
We don’t need more memory-unsafe languages with no generics and no functional programming. We just don’t. If it were a toy project for learning and pedagogical
by jolux 4y ago
We don’t need more memory-unsafe languages with no generics and no functional programming. We just don’t. If it were a toy project for learning and pedagogical purposes that’s one thing but for code that’s supposed to be used in production it’s useless.
- amelius 4y agoNot sure what you mean. Rust has no functional programming either ...
- jolux 4y agoFunctional programming patterns are very common in Rust code. It doesn’t have automatic currying or higher-kinded types but it has generic associated types, anonymous functions, closures, and a rich set of collections with functional processing methods in the standard library.
- capableweb 4y agoA lot of the standard library and an extensive part of the community ecosystem lives and breathes mutation at both the edges and in the internals, something people normally would avoid when trying to stick with functional programming. Sure, some mutation is always needed, but Rust wouldn't be the first language I'd pick if I want to focus on functional programming for sure.
- zozbot234 4y agoMutation within a single program flow is a well-known functional programming pattern, e.g. as supported by the ST feature in Haskell. Shared mutability is much harder to reason about, so is generally excluded and Rust implements it separately.
- jolux 4y agoNo, but it’s widely acknowledged that functional programming features are useful even in imperative languages. Almost every imperative language that isn’t C, Go, or Hare has them. Java, C#, JavaScript, Python, Ruby. You should take a look at all the functions available on iterators in Rust if you haven’t. The Rust community tends to prefer using iterators to express things like looping when possible, which is a more functional style.
- zozbot234 4y agoRust is a functional programming language, that's exactly what's implemented in the basic borrow checking rules. Interior mutability is added to that featureset, so as to support procedural programming with shared mutable state.
- throwaway17_17 4y agoI can not agree with Rust being a functional programming language. I don’t think it has NO functional style idioms, but the borrow checking does not make it functional. That would imply that the only characteristic of functional programming is some sort of ‘variable’ mutability constraint. I may not be up to defining functional programming by exclusion, I think any definition of functional programming includes things Rust does not have.
- dgb23 4y agoIt borrowed some FP concepts, it's influenced by FP but it's definitely not an FP language. It's very much a language about imperative, explicit control. And that's a good thing for the use-cases that Rust targets. It doesn't have in-built immutable data structures, most basic data structures and types are mutable and have mutate in place methods as their primary way of interaction. Struct fields being private by default is a dead giveaway (unnecessary in an FP language). Closures and functions are not the same thing and you cannot do much with them except calling them and passing them around. I would rather describe it as an imperative language with lightweight OO (via traits) and some FP sprinkled on top. Note I'm not saying you cannot write FP code in it or that Rust doesn't have great unique benefits.
- zozbot234 4y ago> It doesn't have in-built immutable data structures Immutable data structures by default would involve avoidable overhead, so that's why they aren't a built in. There are well-known crates that do provide persistent data structures in Rust. > Struct fields being private by default is a dead giveaway (unnecessary in an FP language). Data hiding is just as useful in functional programming; in particular, it enables you to expose an interface to data that stays valid under any isomorphism, while preserving desired invariants. Structs with generally accessible and updatable fields are a special case.
- samhw 4y ago> for code that’s supposed to be used in production it’s useless Then ... don't use it. Others can use it and see what they learn from it, or even whether they find it productive to build stuff with. Even Brainfuck and Malbolge have devoted users who enjoy the challenges they pose, so I can promise you there's room enough in the world for this language. Let's just have some camomile tea and calm down a little.
- HL33tibCe7 4y agoExcept maybe one day I'll be using some software written in Hare which will mess up and have negative implications for me. Furthermore, it could be argued that our time could be spent more productively than on a language like Hare.
- samhw 4y agoThen don't use that software. If you're right, software made with it will be worse - if even producible - and it won't take off. I'm sorry, but the ship has sailed: it is already possible to create bad software. The Hare language is not opening some hitherto-unopened Pandora's box. The same forces carrying good software to the top, and bad software to the bottom - and with them the tools used to make both the former and the latter - will continue to function. As for whether our lives could be used better, well, let's leave that to each individual. I heartily encourage you to live your life as I do, worrying about what I myself am spending time on (currently: this inane conversation), rather than whether other people might be spending their own time in some supposedly-slightly-suboptimal manner.
- wheelerof4te 4y agoFor Christ's sake, you already use messed up software. It is literally everywhere. Your kernel, your networking stack, your interpreters, your office suite. Almost everything you use has some roots in C, a memory unsafe language that "messed up" and still became the most widely used language ever. Software will always mess up, regardless of language it's written in.
- turminal 4y agoWhat, in your opinion, does functional programming bring to the table for writing things Hare is designed for?
- jolux 4y agoSame things it does for Rust.
- wheelerof4te 4y agoClearly, it brings a warped perspective on how a CPU functions. Do I really have to guess the order that my procedures are called? FP zealots say that I do.
- capableweb 4y agoYou sure speak surely about "us" like there is just one group of programmers out there. Some people love JavaScript, some people love C. Some people only use programming languages, some create new ones. Live and let live, don't tell others what they need.
- rowanG077 4y agoHonestly memory unsafe languages shouldn't be used with exception of very few corner cases. It's the same reason why we no longer allow cars without seatbelts. You don't go around saying that seatbelts shouldn't be mandatory because you don't need them.
- netr0ute 4y agoWhat's with this obsession about what other people do? You don't have to use a memory unsafe language, but others might.
- jolux 4y agoI’m allowed to have opinions about what tools should be used for what. I think it’s fair to say you shouldn’t write a production HTTP service in assembly, for example.
- netr0ute 4y agoThe problem with this is that you're now the Ministry Of Truth of programming tools.
- jolux 4y agoYou're allowed to disagree with me. I don't claim to be the ultimate authority and I have no power to enforce my opinions. If I were your tech lead and you wanted to use Hare for something I would probably say no but we could have a discussion about it and you might convince me otherwise. But that's not the context here. This is a programming forum, so I will speak my mind.
- tayistay 4y agoThis point has been made so many times that it gets tiresome. Perhaps that's ok, but it doesn't really tell us anything new.
- wheelerof4te 4y agoWhy do you feel the need to mention functional programming in a thread about a clearly structured, systems programming language? What makes generics and functional programming style mandatory for any given language? These things just add complexity and philosophy to a field that values pragmatic thinking. Functional programming is not pragmatic. And neither are thusand ways to handle generics.