The problem with this analogy is that everything being an object doesn't by you much. But in Haskell, the type system helps you keep track of what's pure and what's not. So having a type system that keeps track of purity buys you something: lots of pure and extremely easy to reason about code. Non-deterministic (unpure) code is the same difficulty to reason about in any language. Isolating it from pure code just reduces the amount of code which is difficult to reason about.
What's wrong with Object-Oriented Programming and Functional Programming
91–100 of 145 posts
Re: What's wrong with Object-Oriented Programming and Functional Programming
#92This person is pursuing a PhD in Computer Science? "If you look deep into them, monads make programs complicated and hard to write, and monad transformers are just ugly hacks." Wow. Just... wow.
Re: What's wrong with Object-Oriented Programming and Functional Programming
#93Earlier quoted context omitted.
FactoryFactoryFactoryClass, most of dependency injection frameworks, anonymous classes, several different one-method interfaces, (such as event handlers/observers), and probably more become unnecessary when you have first-class functions.
I am currently experimenting with Spring JavaBased config (As opposed to XML based) It seems to me that a lot of those factories are created to be able add complex behavior in the XML configuration. I almost want to say that it is XML injection what is causing such complexity.
To see this in action, try googling "factory pattern in Python". You will find hardly any results.
Re: What's wrong with Object-Oriented Programming and Functional Programming
#94This is solved long ago, without taking any extremes. In short, a language should be mostly-functional, which means when you really need to overwrite a value you just do it. In well-researched languages, such as Scheme you have set!, in CLs you have setf. All the monadic stuff (remember, that a monad is nothing but an ADT - Abstract Data Type) is already an extreme, because one must structure the code in a certain wa…
You can't have monads in Scheme due to the lack of a type system. What you can have are instances of monads, but the point of using the concept of a monad is to abstract over it, and to have functions that work with any possible instance.
(with-monad m
(monad-operation data))
See https://github.com/clojure/algo.monads for an implementation of this in Clojure.Re: What's wrong with Object-Oriented Programming and Functional Programming
#95This article is remarkably low on arguments , despite being so long. Just a few of its gems: > OOP is wrong because of its definition of an “object”, and its attempt of trying to fit everything into it. When that goes to the extreme, you arrive at the notion “everything is an object“. But this notion is wrong, because: > There exists things that are not objects. Functions are not objects. This has two problems: 1. It…
>> There are a lot of things wrong with Java, of course, which does not mean that they are also issue of object-oriented programming. Inheritance (sorry...) doesn't work both ways: the fact that a Lexus is prohibitively expensive doesn't mean moving vehicles are prohibitively expensive. But isn't the main point of the article that OOP just doesn't always fit the problem domain, that sometimes you want to model someth…
Re: What's wrong with Object-Oriented Programming and Functional Programming
#96Earlier quoted context omitted.
You can't have monads in Scheme due to the lack of a type system. What you can have are instances of monads, but the point of using the concept of a monad is to abstract over it, and to have functions that work with any possible instance.
> You can't have monads in Scheme due to the lack of a type system. You can have monads in almost any language. The lack of static typing means you don't have static type safety with them, but monads aren't any different than anything else in that regard. > What you can have are instances of monads, but the point of using the concept of a monad is to abstract over it, and to have functions that work with any possible…
They were probably talking about the way Haskell can figure out which monad you're in through type inference. As an example, `return :: a -> m a` dispatches on the type of the function's return value, which doesn't map cleanly to a dynamically typed implementation. You need to be explicit about the monad you're in if you don't have the compiler helping you out.
Re: What's wrong with Object-Oriented Programming and Functional Programming
#97This is an interesting article. It is the first critique of functional programming I've read from someone who clearly knows their shit. I plan to look at miniKanren more when I get the chance. I done a fair amount of math though likely less than the author but I have a similar impression - the things that are hardest to understand aren't necessarily the best tool for every job, despite their beauty. And beautiful abs…
It is the first critique of functional programming I've read from someone who clearly knows their shit. The critique is 'Haskell takes FP to an extreme and I show this is true because someone tried to implement miniKanren and needed Oleg to do it'. That is not really a strong argument. Also note that he isn't really arguing against functional programming, but pure functional programming . the things that are hardest…
>That is not really a strong argument.
It's worse than that. The linked paper is about implementing minikanren as a monad transformer, which is a lot trickier than just porting it over, regardless of language. It's probably a lot easier in Haskell than in Scheme though.
Furthermore, if pure FP is useless, then monad transformers are useless too. But then the argument becomes "this useless thing is really tricky to implement in Haskell, therefore Haskell is useless". The only reason you would want Oleg's minikanren to be easy to implement is if you actually want pure FP. So the argument kind of negates itself.
Re: What's wrong with Object-Oriented Programming and Functional Programming
#98Is there a blend between the two? I really like loops...
Re: What's wrong with Object-Oriented Programming and Functional Programming
#99Just http://www.scala-lang.org/ and everybody's happy :)
Re: What's wrong with Object-Oriented Programming and Functional Programming
#100This is solved long ago, without taking any extremes. In short, a language should be mostly-functional, which means when you really need to overwrite a value you just do it. In well-researched languages, such as Scheme you have set!, in CLs you have setf. All the monadic stuff (remember, that a monad is nothing but an ADT - Abstract Data Type) is already an extreme, because one must structure the code in a certain wa…
You can't have monads in Scheme due to the lack of a type system. What you can have are instances of monads, but the point of using the concept of a monad is to abstract over it, and to have functions that work with any possible instance.
Think again, Paul Khoung walks you through implementing some monads using call/cc