Functional Programming in C++ C++ Support for Functional Paradigm

Functional Programming in C++ C++ Support for Functional Paradigm

Introduction Functional Programming in C++ C++ Support for Functional Paradigm Bartosz Kwaśniewski . Bartosz Kwaśniewski Functional Programming in C++ 1 / 131 “I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers” Introduction Hi did it for all of us ;) Bjarne Stroustrup . Bartosz Kwaśniewski Functional Programming in C++ 2 / 131 Introduction Hi did it for all of us ;) “I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers” Bjarne Stroustrup . Bartosz Kwaśniewski Functional Programming in C++ 2 / 131 I Is it true, is it really true? I What does it mean? I C++ supports or has just recently started to support functional programming I Questions: Introduction Claims and Questions I Claims: . Bartosz Kwaśniewski Functional Programming in C++ 3 / 131 I Is it true, is it really true? I What does it mean? I Questions: Introduction Claims and Questions I Claims: I C++ supports or has just recently started to support functional programming . Bartosz Kwaśniewski Functional Programming in C++ 3 / 131 I Is it true, is it really true? I What does it mean? Introduction Claims and Questions I Claims: I C++ supports or has just recently started to support functional programming I Questions: . Bartosz Kwaśniewski Functional Programming in C++ 3 / 131 I What does it mean? Introduction Claims and Questions I Claims: I C++ supports or has just recently started to support functional programming I Questions: I Is it true, is it really true? . Bartosz Kwaśniewski Functional Programming in C++ 3 / 131 Introduction Claims and Questions I Claims: I C++ supports or has just recently started to support functional programming I Questions: I Is it true, is it really true? I What does it mean? . Bartosz Kwaśniewski Functional Programming in C++ 3 / 131 2. You could use many styles including object oriented and functional to make better software 3. There is no other option, no turning back: you must learn the functional paradigm Introduction Key Messages 1. Paradigm shift towards functional programming is necessary and has already started . Bartosz Kwaśniewski Functional Programming in C++ 4 / 131 3. There is no other option, no turning back: you must learn the functional paradigm Introduction Key Messages 1. Paradigm shift towards functional programming is necessary and has already started 2. You could use many styles including object oriented and functional to make better software . Bartosz Kwaśniewski Functional Programming in C++ 4 / 131 Introduction Key Messages 1. Paradigm shift towards functional programming is necessary and has already started 2. You could use many styles including object oriented and functional to make better software 3. There is no other option, no turning back: you must learn the functional paradigm . Bartosz Kwaśniewski Functional Programming in C++ 4 / 131 I Moore’s law (free lunch is over) I Heat wall, no more clock race (max 3.4GHz) I Multi-core arrival (solution) I Concurrent software (require redesign) I Object oriented pitfalls I Composability (concurrency not scale well) I Different approach: functional programming (purity, immutability) Introduction But, Why? I Why? . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 I Heat wall, no more clock race (max 3.4GHz) I Multi-core arrival (solution) I Concurrent software (require redesign) I Object oriented pitfalls I Composability (concurrency not scale well) I Different approach: functional programming (purity, immutability) Introduction But, Why? I Why? I Moore’s law (free lunch is over) . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 I Multi-core arrival (solution) I Concurrent software (require redesign) I Object oriented pitfalls I Composability (concurrency not scale well) I Different approach: functional programming (purity, immutability) Introduction But, Why? I Why? I Moore’s law (free lunch is over) I Heat wall, no more clock race (max 3.4GHz) . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 I Concurrent software (require redesign) I Object oriented pitfalls I Composability (concurrency not scale well) I Different approach: functional programming (purity, immutability) Introduction But, Why? I Why? I Moore’s law (free lunch is over) I Heat wall, no more clock race (max 3.4GHz) I Multi-core arrival (solution) . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 I Object oriented pitfalls I Composability (concurrency not scale well) I Different approach: functional programming (purity, immutability) Introduction But, Why? I Why? I Moore’s law (free lunch is over) I Heat wall, no more clock race (max 3.4GHz) I Multi-core arrival (solution) I Concurrent software (require redesign) . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 I Composability (concurrency not scale well) I Different approach: functional programming (purity, immutability) Introduction But, Why? I Why? I Moore’s law (free lunch is over) I Heat wall, no more clock race (max 3.4GHz) I Multi-core arrival (solution) I Concurrent software (require redesign) I Object oriented pitfalls . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 I Different approach: functional programming (purity, immutability) Introduction But, Why? I Why? I Moore’s law (free lunch is over) I Heat wall, no more clock race (max 3.4GHz) I Multi-core arrival (solution) I Concurrent software (require redesign) I Object oriented pitfalls I Composability (concurrency not scale well) . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 Introduction But, Why? I Why? I Moore’s law (free lunch is over) I Heat wall, no more clock race (max 3.4GHz) I Multi-core arrival (solution) I Concurrent software (require redesign) I Object oriented pitfalls I Composability (concurrency not scale well) I Different approach: functional programming (purity, immutability) . Bartosz Kwaśniewski Functional Programming in C++ 5 / 131 “It was only supposed to be a joke. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient” Bjarne Stroustrup “When the limestone of imperative programming is worn away, the granite of functional programming will be observed.” Simon Peyton Jones (GHC) Introduction Really smart guy’s says “The problem with object-oriented languages is that if you wanted a banana but what you got was a gorilla holding the banana and the entire jungle” Joe Armstrong, Erlang Creator . Bartosz Kwaśniewski Functional Programming in C++ 6 / 131 “When the limestone of imperative programming is worn away, the granite of functional programming will be observed.” Simon Peyton Jones (GHC) Introduction Really smart guy’s says “The problem with object-oriented languages is that if you wanted a banana but what you got was a gorilla holding the banana and the entire jungle” Joe Armstrong, Erlang Creator “It was only supposed to be a joke. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient” Bjarne Stroustrup . Bartosz Kwaśniewski Functional Programming in C++ 6 / 131 Introduction Really smart guy’s says “The problem with object-oriented languages is that if you wanted a banana but what you got was a gorilla holding the banana and the entire jungle” Joe Armstrong, Erlang Creator “It was only supposed to be a joke. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient” Bjarne Stroustrup “When the limestone of imperative programming is worn away, the granite of functional programming will be observed.” Simon Peyton Jones (GHC) . Bartosz Kwaśniewski Functional Programming in C++ 6 / 131 Introduction Table of Contents 1 Introduction 2 Programming Paradigms 3 Functional Programming 4 C++ Metaprogramming as Functional Language 5 Conclusion . Bartosz Kwaśniewski Functional Programming in C++ 7 / 131 I What does it mean that a language supports a paradigm well? Programming Paradigms About Programming Paradigms . Bartosz Kwaśniewski Functional Programming in C++ 8 / 131 Programming Paradigms About Programming Paradigms I What does it mean that a language supports a paradigm well? . Bartosz Kwaśniewski Functional Programming in C++ 8 / 131 Programming style or approach based on a co- herent set of programming concepts aimed to solve particular kind of problem. Programming Paradigms Paradigm Definition I What is a paradigm? . Bartosz Kwaśniewski Functional Programming in C++ 9 / 131 Programming Paradigms Paradigm Definition I What is a paradigm? Programming style or approach based on a co- herent set of programming concepts aimed to solve particular kind of problem. Bartosz Kwaśniewski Functional Programming in C++ 9 / 131 Programming Paradigms Programming Languages, Paradigms and Concepts . Bartosz Kwaśniewski Functional Programming in C++ 10 / 131 1. Real and different problems need different programming concepts to solve them cleanly 2. However: this requires the expetise level 1. Programming using more than one programming style, each to its best effect 2. The same as just ”programming” but using different features in combination as needed I Why do we need multiparagim languages? Programming Paradigms Multiparadigm Programming I What is Multiparadigm programming? . Bartosz Kwaśniewski Functional Programming in C++ 11 / 131 1. Real and different problems need different programming concepts to solve them cleanly 2. However:

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    561 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us