Dart is a Functional Language?

1,725 views
Skip to first unread message

Giovanni Silva

unread,
Dec 27, 2013, 8:36:02 PM12/27/13
to mi...@dartlang.org
I start to learn about functional programming, well more oficial because I do some things without know the term. As I can see Dart have some important aspects of functional programming:

Functions is a class first citizen. That means, functions can be  treated as variables and classes, passed as arguments, written as literals and so on.
The Stream API have good ways to use functions for filtering, map, reduce and some common operations
If want list more aspects comment this post.

I'm studding Scala and I start to like very much functional programming. Scala mix very well Object Oriented with functional programming. Is Dart going to the same route? Clearly Dart have some inspiration on functional programming, what do you think? 

Ruud Poutsma

unread,
Dec 28, 2013, 6:10:48 AM12/28/13
to mi...@dartlang.org
Probably a bit too heavy on your stomach if you're just new to functional programming. Still, http://www.infoq.com/presentations/functional-pros-cons brings a nice perspective on functional sense and nonsense.

Cogman

unread,
Dec 28, 2013, 10:11:01 AM12/28/13
to mi...@dartlang.org
Dart is not a functional language. It is very much a procedural language with functional aspects.

Scala isn't really truly a functional programming language, don't get me wrong, it incorporates a lot of functional characteristics (it is borderline functional) but deep down inside it is still just a procedural language with a ton of functional niceness.

If you want to see what I would consider true functional languages, take a look at Lisp (Closure), Haskell, erlang, or F#.  The difference is very pronounced.

Don't take this as a slight towards dart or Scala. I think they strike a good balance and take away some of the more important aspects of functional programming.


--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Thomas Stephenson

unread,
Jan 2, 2014, 3:13:39 AM1/2/14
to mi...@dartlang.org
Probably a bit too heavy on your stomach if you're just new to functional programming. Still, http://www.infoq.com/presentations/functional-pros-cons brings a nice perspective on functional sense and nonsense.

Thanks for posting that, I got a lot out of that, even if the OP might not have. 
-- Hindley-Miller inference is a necessity in ML style languages, as the type system would end up obfuscating the code if there was no inference. His arguments about losing the redundancy of declared types in the presence of inference is avoided by following best practices (always declaring the types of module level functions unless the type is obvious (eg. field accessors)).
-- I'm not sure what is meant about pattern matching being type coercion in disguise
-- Having generic interfaces for monads, applicative functors, foldables etc. in the standard libraries is no different from having generic interfaces for Iterables, Lists, Sets, Arrays, Maps etc. in the collections implementation in the standard library, they're just at a higher level of abstraction. It's a hell of a lot easier than having different incompatible syntactic constructs for lists, streams, optionals, exceptions, futures etc.

The section about tail call elimination being the defining characteristic of "functional languages" really struck a note though and in general I agreed with his core points. 


--

Giovanni Silva

unread,
Jan 2, 2014, 1:29:35 PM1/2/14
to mi...@dartlang.org
The presentation is enlightening. Thank you.

Alexandru Nedelcu

unread,
Jan 5, 2014, 6:14:21 AM1/5/14
to mi...@dartlang.org
On Saturday, December 28, 2013 5:11:01 PM UTC+2, Thomas May wrote:
Scala isn't really truly a functional programming language, don't get me wrong, it incorporates a lot of functional characteristics (it is borderline functional) but deep down inside it is still just a procedural language with a ton of functional niceness.

If you want to see what I would consider true functional languages, take a look at Lisp (Closure), Haskell, erlang, or F#.  The difference is very pronounced.

That's nonsense. Scala is more FP than F#, because F# doesn't do higher kinded types or type-classes. And personally I consider F# to be an ugly language, because it contains two type systems in the same language that don't blend well. 

On Scala, I did encounter this sentiment a lot, but it's mostly based on folklore. In particular, Scala's ecosystem deploys a larger number of concepts coming from FP/Haskell, than any other language you mentioned, except for Haskell - persistent data-structures, monads, applicative functors, iteratees, machines, fsm actors, stm, you name it. Take a look at Scalaz and there's also a wonderful new book called "Functional Programming in Scala", which is just awesome. This "no true Scotsman" fallacy needs to die.
Reply all
Reply to author
Forward
0 new messages