Ostrava je prdel!!!

3 programovací jazyky budoucnosti

Barcamp Ostrava 2013

Disclaimer I

Disclaimer II

Context

Pravěk

Fortran, o rok později LISP, nakonec "vyhrává" C

(ve stejné době vzniká Prolog)

Context

70. - 80. léta

C++, ML, standardizace komunit

Context

Poslední dvě (a něco) dekády

Java, intepretry, DSL, "návrat" funkcionálního programování

2005 - 2007 - 2009

RabbitMQ - CouchDB - Riak

Erlang

Features

Přednáška není ani tak o konkrétních jazycích

Je o jejich specifických vlastnostech

Cast

Elixir

... functional, concurrent, general-purpose programming language built atop the Erlang Virtual Machine (BEAM)

Wikipedia

Features

Hello World

defmodule Hello do
  IO.puts "Defining the function world"

  def world do
    IO.puts "Hello World"
  end

  IO.puts "Function world defined"
end

Hello.world

Hello World - result

Defining the function world
Function world defined
Hello World

Pattern matching

defmodule Greeter do
    def greet(:male, name) do
        IO.puts "Hello, Mr. #{name}!"
    end

    def greet(:female, name) do
        IO.puts "Hello, Mrs. #{name}!"
    end

    def greet(_, name) do
        IO.puts "Hello, #{name}!"
    end
end

Pattern matching - result

Greeter.greet(:female, 'Anna')
Greeter.greet(:alien, 'E.T.')
Hello, Mrs. Anna!
Hello, E.T.!

Protocols

defprotocol JSON do
    def to_json(item)
end

defimpl JSON, for: List do
# ...
end

defimpl JSON, for: Number do
# ...
end

Custom protocol

defimpl JSON, for: MyAwesomeType do
# ...
end

Homoiconicity

defmodule Homoicon do
    defmacro unless(expr, opts) do
        quote do
            if(!unquote(expr), unquote(opts))
        end
    end
end

Why

Síla Erlangu obalená přívětivější syntaxí, makry a protokoly

More info

Julia

... a high-level dynamic programming language designed to address the requirements of high-performance numerical and scientific computing while also being effective for general purpose programming

Wikipedia

Features

IJulia

Demo time

Methods

f(x::Float64, y::Float64) = 2x + y;

try
    f(2.0, 3)
catch y
    println(y)
end

f(x::Number, y::Number) = 2x - y;

println(f(2.0, 3))

Methods - result

MethodError(f,(2.0,3))
1.0

Why

Numerické a vědecké výpočty často rychlejší než v C/Fortranu, přehledný typový systém, rozšířitelnost

More info

LiveScript

... adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming

LiveScript homepage

Features

Functions everywhere

take = (n, [x, ...xs]:list) -->
  | n <= 0     => []
  | empty list => []
  | otherwise  => [x] ++ take n - 1, xs

take 2, [1 2 3 4 5]
[ 1, 2 ]

Composition

take-three = take 3
last-three = reverse >> take-three >> reverse
last-three [1 to 8]
[ 6, 7, 8 ]

Why

Trochu kočkopes, dá se očekávat větší příklon k funkcionálním vlastnostem

More info

Honorable mentions

Clojure

Lispers

Clojure

Dialekt LISPu nad JVM

Honorable mentions

Nimrod

A new statically typed, compiled programming language which supports metaprogramming

Lambda the Ultimate

Thanks

Martin Putniorz
@sputnikus
slides

wow such endorsement

Dogecoin

DBgJe1CMSF1xLtvtLiN9yLyonMykhQxLN1