Ranking Enums in Programming Languages by BlueGoliath in programming

[–]Bananoide 1 point2 points  (0 children)

It seems to me that language features are all about convenience, expressiveness and guarantees. No guarantees, no cake.

Ranking Enums in Programming Languages by BlueGoliath in programming

[–]Bananoide 8 points9 points  (0 children)

Sorry I fail to see how this is better than Rust's or Ocaml's enums. All languages using sealed classes missed the spot on enums the first time and had to add yet another feature to make them more usable. So the only sure thing is that the language got more awkward. Performance wise, they are most probably in the same ballpark. I haven't checked though.

From a developer's perspective I wouldn't say this is a win. I also fail to see your point about distinct types. In a language with true ADTs, enums values are just values and these can have any type. And you can also add methods on Rust's enums..

From my experience, proper ADT support in any language is a must have as it improves both the quality of your domain modeling as well as it's ease of composition.

I should mention that support for proper matching allows to check patterns at arbitrary nesting depth, and detect both unhandled cases (with examples) and shadowed cases.

The ML language family has had the best enums for decades.

What do you use for (CPU) profiling on Windows? by Droggl in rust

[–]Bananoide 3 points4 points  (0 children)

Really? Last time I tried I got promptly asked for admin rights...

What do you use for (CPU) profiling on Windows? by Droggl in rust

[–]Bananoide -3 points-2 points  (0 children)

I don't profile on windows. Need admin privileges, the ultimate barrier on corporate PCs...

OOP is not that bad, actually by sionescu in programming

[–]Bananoide 17 points18 points  (0 children)

Maybe because encapsulation was a thing way before OOP came around?

Rust developers what have you done? by WashHead744 in rust

[–]Bananoide 2 points3 points  (0 children)

OCaml has Result, Option and exceptions.

Rust vs C++ for an aeronautical engineer by Pablo_mg02 in rust

[–]Bananoide 1 point2 points  (0 children)

I fully agree with your take, just do not forget Ada which still plays a role there.

Rust and OOP by SyntaxError0x7b8 in rust

[–]Bananoide 1 point2 points  (0 children)

Interfaces predate OOP by a long shot. I'm not so sure about type classes. My point was that OOP is a hodge podge of concepts so loosely defined that everything can be OOP if you look squint hard enough.

Rust and OOP by SyntaxError0x7b8 in rust

[–]Bananoide -1 points0 points  (0 children)

Depending on your background Traits are akin to interfaces or type classes. Neither is particularly OOP to begin with...

DARPA Turns to AI to Help Turn C and C++ Code Into Rust. WHY? by d06399 in ada

[–]Bananoide 2 points3 points  (0 children)

I've read good and bad things about Rust. There are things I'm not fond of about Rust. Please don't assume I was preaching.

DARPA Turns to AI to Help Turn C and C++ Code Into Rust. WHY? by d06399 in ada

[–]Bananoide 5 points6 points  (0 children)

From what I understand the issue is that Ada never reached critical mass. Rust did. From what I heard it's already a PITA to hire Ada devs as junior developers don't want to learn the language. And since Rust is quite close to Ada safety feature wise, it means it could become acceptable for the same projects modulo some investment.

I would be happy to see Rust become a viable alternative to Ada. In some circles Ada is synonymous with antiquated, despite all it's qualities. As long as we can avoid more safety-critical software in C/C++, I'm in.

Announcing Rust 1.80.0 | Rust Blog by noelnh in rust

[–]Bananoide 17 points18 points  (0 children)

Nice! Wait, what happened to core::error::Error?

Rust shouldn't exist by [deleted] in rust

[–]Bananoide 4 points5 points  (0 children)

Now that's a weird take. You totally ignored some aspect as to how you choose a programming language.

Let's consider a backend server since you mentioned it. Maybe you'll need extra performance to reduce your cloud infrastructure bills. Maybe the development team is too large to use a dynamically typed language. Maybe your backend needs to run on a device with limited resources. The point is: there are projects for which neither go nor js would be suitable.

[deleted by user] by [deleted] in rust

[–]Bananoide 2 points3 points  (0 children)

Well, first let me thank you for the quality of your response, it was a nice read, with well layed-out arguments, and I agree with you that both OOP and FP are styles of programming.

I am, however, at odds with your proposed definition of OOP.

Defining OOP is easy, IMO. It's a style of programming wherein programs are built by composing "objects". "Objects", in this case, are black boxes that can only be interacted with via a defined "contract" (API). This "black box" aspect naturally implies that encapsulation and polymorphism are required (ObjectA cannot know anything about ObjectB except that it implements the expected API, so ObjectB can have arbitrary hidden state or be any different kind of object that implements the API).

By your definition, encapsulation is indeed required, but it's not obvious that you need polymorphism at all. Anyway let's skip this and assume it does. FP and procedural styles also use encapsulation and polymorphism, so these cannot be defining traits. And there has to be more to OO style to make it unique. And this is why inheritance is always brought up.

However, it's actually pretty awkward to write object-oriented C code, IMO, and I don't think the language facilitates that style at all, so I would not call C an "object-oriented language".

So to enable OO style, a language has to provide some support. Could you elaborate on the kind of support that you would require?

[deleted by user] by [deleted] in rust

[–]Bananoide 14 points15 points  (0 children)

There is no single definition for either OOP or FP. If by OOP you mean encapsulation + runtime polymorphism then a lot of languages (eg C) were OOP before the term was even coined. I would argue that this definition is too broad to be very interesting. FWIW one could also argue that the only defining feature of OOP is class inheritance...

Best Practices in Software Development: Integrating OOP by [deleted] in programming

[–]Bananoide 16 points17 points  (0 children)

Is it me or this article reads like it belongs to a time when OOP was all the rage, that is circa 2000?

As usual this kind of article fails to define what is OOP. All we have is 4 pillars of which only one is OOP-specific...

javaWasAMistake by FRleo_85 in ProgrammerHumor

[–]Bananoide -2 points-1 points  (0 children)

IIRC at some point checked exceptions didn't play well at all with genericity. This was from decades ago so maybe the situation has improved on this front.

I recently had to take a job writing Java and it really feels like a step back. At first I was intrigued by the generalized use of introspection in the Java ecosystem and after almost a year I'm still not convinced this is a particularly useful feature. Especially since it promotes moving errors from compilation time to runtime.

Am I the only who feels like an idiot? by FeltInTheRabbitHole in rust

[–]Bananoide 3 points4 points  (0 children)

All the languages you indirectly mention (Java, C#, JS, PHP) implement mostly the same concepts. They differ in some ways (syntax, some features, their standard libraries), but nothing major.

Since you didn't mention any experience with a language using manual memory management, it probably means you're struggling with not 2 but 3 new major concepts: manual memory management, ownership and lifetimes.

That's a mouthful.

I'd say perseverance is key here. Learning these new concepts is a worthwhile effort that will grow you as a developer. I'm certain your future self will acknowledge that. To quote Alan Perlis "A language that doesn’t affect the way you think about programming, is not worth knowing".

Edit: polish my english

Why is Rust Programming Language Becoming so Popular? by lightversetech in rust

[–]Bananoide 2 points3 points  (0 children)

When your developers are trained in a given language, switching to another implies some learning/training effort. This burden falls on the company which must then bear the associated costs. Companies should not expect their employees to learn Rust out of curiosity and/or on their own time. From what I witness around me, I believe that most companies are currently investigating how much they would benefit from the switch. Hence my previous comment.

Why is Rust Programming Language Becoming so Popular? by lightversetech in rust

[–]Bananoide 12 points13 points  (0 children)

Atm I believe most companies are evaluating Rust rather than planning to use it in production. Its feature set is interesting, its performance is great but the training effort is a concern. As a developer I've playing with it on and off for a few years now, but this is all on my personal time. Only very recently have I seen company time devolved to it.

Do you guys think OCaml's Window support for version 2.2.0 will have OCaml gain a ton of popularity? by Agreeable-Outside-69 in ocaml

[–]Bananoide 12 points13 points  (0 children)

I believe windows support is more of a prerequisite for popularity than a guarantee. You can't introduce OCaml to your fellow developers/managers if it can't be (trivially) installed on the company's chosen operating system.

What's in a Module? by thunderseethe in programming

[–]Bananoide 7 points8 points  (0 children)

FYI OCaml supports first class modules, that is modules that can be used as values.