SlideShare a Scribd company logo
1 of 82
Download to read offline
New C++ features for writing DSLs
CoreHard 2019, Minsk
dr Ivan Čukić
ivan@cukic.co
http://cukic.co
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
About me
Independent trainer / consultant
KDE developer
Author of the ”Functional Programming in C++” book
University lecturer
2
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Disclaimer
Make your code readable. Pretend the next person who looks at
your code is a psychopath and they know where you live.
Philip Wadler
3
INTRODUCTION
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Introduction
select name from participants;
<expr> ::= <var> | <lit> | <expr> <op> <expr>
[a-zA-Z][a-zA-Z0-0_]*
5
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
DSLs and C++
Limited:
.something syntax
Operators
Braces and parentheses
6
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Introduction
<=>
7
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Introduction
<_/_~~*~~,,,,,___/,,,>
8
BASICS
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
user.name = ”Martha”;
user.surname = ”Jones”; // exception!
user.age = 42;
10
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Copy-and-swap
type& operator=(const type& value)
{
auto tmp = value;
tmp.swap(*this);
return *this;
}
11
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
auto tmp = user;
tmp.name = ”Martha”;
tmp.surname = ”Jones”;
tmp.age = 42;
tmp.swap(user);
12
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
with(user) (
name = ”Martha”,
surname = ”Jones”,
age = 42
);
13
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
with(user)()
operator= operator= operator=
name "Martha" surname "Jones" age 42
14
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
class transaction {
public:
transaction(user_t& user) Defines the object
: m_user{user} the transaction will
{} operate on
void operator() (⋯)
{
⋯
}
private: A reference to the
user_t& m_user; object
}; 15
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
class transaction {
public:
transaction(user_t& user)
: m_user{user}
{}
void operator() (⋯) Call operator takes
{ a list of actions
⋯ to perform
}
private:
user_t& m_user;
}; 15
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
with(user)()
operator= operator= operator=
name "Martha" surname "Jones" age 42
16
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
template <typename Member, typename Value>
struct update {
update(Member member, Value value)
: member{member}
, value{std::move(value)}
{
}
Member member;
Value value;
};
Note that the update structure does not know which object it will be
updating.
17
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
with(user)()
operator= operator= operator=
name "Martha" surname "Jones" age 42
18
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
template <typename Member>
struct field {
field(Member member)
: member{member}
{
}
template <typename Value>
update<Member, Value> operator=(Value&& value) const
{
return update{member, FWD(value)};
}
Member member;
};
19
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
field name{⋯};
field surname{⋯};
field age{⋯};
20
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
#define field(name) field_impl([] (auto& object) -> auto& { 
return object.name; 
})
with(user) (
field(name) = ”Martha”,
field(surname) = ”Jones”,
field(age) = 42
);
21
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
with(user)()
operator= operator= operator=
name "Martha" surname "Jones" age 42
22
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
with(user)()
operator= operator= operator=
name "Martha" surname "Jones" age 42
23
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Transaction
We’ll model a simple transaction concept:
The update action is activated using the call operator:
Each update action returns a bool indicating success or failure.
auto update_action{name = ”Martha”};
if (update_action(user)) {
// success
}
24
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Transaction
class transaction {
public:
template <typename... Updates>
bool operator() (Updates&&... updates)
{
auto temp = m_user;
Invoke each update action on the temp
object, and swap temp and *this only
if they all succeeded
}
};
25
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Transaction
class transaction {
public:
template <typename... Updates>
bool operator() (Updates&&... updates)
{
auto temp = m_user;
if ((... && FWD(updates)(temp))) {
temp.swap(m_user);
return true;
}
return false;
}
};
26
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Basics first
Ideal simple DSL:
Context-free
AST that fits semantics
Uses only simple constructs
27
CONTEXT
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
service(42042)
| transform(trim)
| remove_if(&std::string::empty)
| filter([] (const std::string& message) {
return message[0] != '#';
})
| sink_to_cerr;
29
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
operator|
operator|
operator|
operator|
30
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
template <typename... Nodes>
class expression {
template <typename Continuation>
auto operator| (Continuation&& cont) &&
{
⋯
}
};
31
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
std::function: type erasure is cool but slow.
Use a right-associative operator »= to appease Haskell gods?
32
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
std::function: type erasure is cool but slow.
Expression templates to the rescue!
32
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
template <typename... Nodes>
class expression {
template <typename Continuation>
auto operator| (Continuation&& cont) &&
{
return expression(
std::tuple_cat(
std::move(m_nodes),
std::make_tuple(FWD(cont))));
}
std::tuple<Nodes...> m_nodes;
};
33
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
auto user_names = users | transform(&user_t::name);
auto ignore_empty = transform(trim)
| remove_if(&std::string::empty);
user_names | ignore_empty | transform(string_to_upper);
34
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
operator|
operator|
operator|
operator|
operator|
operator|
operator|
operator|
35
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
operator|
operator|
operator|
operator|
operator|
operator|
operator|
operator|
36
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Syntax
Different meanings of operator|
Wildly different types of operands (no inheritance tree)
Arbitrary complex AST
37
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Universal expression
template <typename Left, typename Right>
struct expression {
Left left;
Right right;
};
<node> ::= <producer> | <consumer> | <trafo> | <expression>
<expression> ::= <node> <|> <node>
38
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Meta information
Adding meta-information to classes:
struct producer_node_tag {};
struct consumer_node_tag {};
struct transformation_node_tag {};
class filter_node {
public:
using node_type_tag =
transformation_node_tag;
};
39
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Meta information
template <typename Node>
using node_category =
typename remove_cvref_t<Node>::node_type_tag;
40
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Universal expression
template <typename Tag, typename Left, typename Right>
struct expression {
using node_type_tag = Tag;
Left left;
Right right;
};
41
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Meta information
template < typename Node
, typename Category =
std::detected_t<node_category, Node>
constexpr bool is_node()
{
if constexpr (!is_detected_v<node_category, Node>) {
return false;
} else if constexpr (
std::is_same_v<complete_pipeline_tag, Category>) {
return false;
} else {
return true;
}
}
42
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Restricting the pipe
template < typename Left
, typename Right
, REQUIRE(is_node<Left>() && is_node<Right>())
>
auto operator| (Left&& left, Right&& right)
{
⋯
}
43
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Restricting the pipe
template < typename Left
, typename Right
, REQUIRE(is_node<Left>() && is_node<Right>())
>
auto operator| (Left&& left, Right&& right)
{
if constexpr (!is_producer<Left> && !is_consumer<Right>) {
return expression<transformation_node_tag, Left, Right>{
FWD(left), FWD(right)
};
}
⋯
}
44
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Restricting the pipe
template < typename Left
, typename Right
, REQUIRE(is_node<Left>() && is_node<Right>())
>
auto operator| (Left&& left, Right&& right)
{
⋯ else
if constexpr (is_producer<Left> && !is_consumer<Right>) {
return expression<producer_node_tag, Left, Right>{
FWD(left), FWD(right)
};
}
⋯
}
45
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Restricting the pipe
template < typename Left
, typename Right
, REQUIRE(is_node<Left>() && is_node<Right>())
>
auto operator| (Left&& left, Right&& right)
{
⋯ else
if constexpr (!is_producer<Left> && is_consumer<Right>) {
return expression<consumer_node_tag, Left, Right>{
FWD(left), FWD(right)
};
}
⋯
}
46
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Restricting the pipe
template < typename Left
, typename Right
, REQUIRE(is_node<Left>() && is_node<Right>())
>
auto operator| (Left&& left, Right&& right)
{
⋯ else
if constexpr (is_producer<Left> && is_consumer<Right>) {
return expression<complete_pipeline_tag, Left, Right>{
FWD(left), FWD(right)
};
}
}
47
EVALUATION
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Evaluation
operator|
operator|
operator|
operator|
operator|
operator|
operator|
operator|
49
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
AST transformation
1. Collect nodes from the left sub-tree
2. Collect nodes from the right sub-tree
3. Merge the results
50
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
AST transformation
template <typename Expr>
auto collect_nodes(Expr&& expr)
{
auto collect_sub_nodes = [] (auto&& sub) {
if constexpr (is_expression<decltype(sub)>) {
return collect_nodes(std::move(sub));
} else {
return std::make_tuple(std::move(sub));
}
};
return std::tuple_cat(
collect_sub_nodes(std::move(expr.left)),
collect_sub_nodes(std::move(expr.right)));
}
51
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Evaluation
Two choices:
Connect left-to-right
Connect right-to-left
52
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
LTR
Pros:
Easier
Easy to pass value_type around
Cons:
Type erasure
53
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
RTL
Pros:
No need for type erasure
Cons:
No way to pass value_type:
service(42042) | debounce<std::string>(200ms) | ...
54
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Both!
Feed forward and backward connect.
55
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
struct transform_t {
template <typename In>
using value_type_for_input_t = ⋯
};
56
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
using new_value_type =
typename Data::template value_type_for_input_t<ValueType>;
57
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
template <typename LastValueType,
typename... ProcessedNodes>
struct folding_context {
⋯
};
58
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
59
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
template <typename... Nodes>
auto propagate_value_type(Nodes&& ...nodes)
{
return (init_context() % ... % FWD(nodes)).nodes;
}
60
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
template <typename NodesTuple>
auto propagate_value_type(NodesTuple&& nodes)
{
return (init_context() % ... % ???).nodes;
}
61
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
template <typename NodesTuple,
size_t... Idx>
auto propagate_value_type(NodesTuple&& nodes, std::index_sequence<Idx...>)
{
return (init_context() % ... %
std::get<Idx>(FWD(nodes))).nodes;
}
62
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Context propagation
propagate_value_type(
nodes,
std::make_index_sequence<std::tuple_size_v<Tuple>>()
);
63
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Connection
Now we have a list of enriched nodes,
we can connect them right-to-left.
64
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Evaluation
template <typename... Nodes>
auto evaluate_nodes(Nodes&&... nodes)
{
return (... % nodes);
}
65
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Connection
template <typename Node, typename Connected>
auto operator% (Node&& new_node, Connected&& connected)
{
return FWD(new_node).with_continuation(FWD(connected));
}
66
BEST PRACTICES
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Asserts
#define assert_value_type(T) 
static_assert( 
std::is_same_v<T, std::remove_cvref_t<T>>, 
”This is not a value type”)
68
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Printf debugging
template <typename... Types>
class print_types;
print_types<std::vector<bool>::reference>{};
error: incomplete type 'class print_types<std::_Bit_reference>'
69
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Printf debugging
template <typename... Types>
[[deprecated]] class print_types;
70
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Printf debugging
For complex expression template types, create a sanitization script:
basic_string... → string
transformation_node_tag → TRAFO
Change all < and > into ( and ) and pass the output through clang-format.
71
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Printf debugging
expression(
expression(
void,
expression(PRODUCER,
expression(PRODUCER, ping_process,
transform(”(λ tests_multiprocess.cpp:91:26)”)),
transform(”(λ tests_multiprocess.cpp:82:38)”))),
expression(
TRAFO,
expression(TRAFO,
expression(TRAFO,
expression(TRAFO, identity_fn,
transform(”(λ tests_multiprocess.cpp:99:
⋯
72
© Ivan Čukić, 2019
Introduction Basics Context Evaluation Best practices The End
Answers? Questions! Questions? Answers!
Kudos (in chronological order):
Friends at KDE
Saša Malkov and Zoltan Porkolab
Сергей Платонов
Functional Programming in C++
cukic.co/to/fp-in-cpp
73

More Related Content

Similar to New C++ features for writing DSLs . Ivan Čukić. CoreHard Spring 2019

High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14Matthieu Garrigues
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ Ganesh Samarthyam
 
Staroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systemsStaroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systemsSergey Staroletov
 
intro-slides.pdf very important for computer science students
intro-slides.pdf very important for computer science studentsintro-slides.pdf very important for computer science students
intro-slides.pdf very important for computer science studentssairevanth504
 
Ruby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVCRuby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVCSimone Chiaretta
 
Model View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In AspnetModel View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In Aspnetrainynovember12
 
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate PerspectiveBridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate PerspectiveRoberto Casadei
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Servicessusere19c741
 
Custom connector development using mule DevKit
Custom connector development using mule DevKitCustom connector development using mule DevKit
Custom connector development using mule DevKitRamakrishna Narkedamilli
 
Bca5020 visual programming
Bca5020  visual programmingBca5020  visual programming
Bca5020 visual programmingsmumbahelp
 
Features of the Modern C++ 20
Features of the Modern C++ 20Features of the Modern C++ 20
Features of the Modern C++ 20Andrei Novikov
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYRadha Maruthiyan
 
Advanced functional programing in Swift
Advanced functional programing in SwiftAdvanced functional programing in Swift
Advanced functional programing in SwiftVincent Pradeilles
 

Similar to New C++ features for writing DSLs . Ivan Čukić. CoreHard Spring 2019 (20)

High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
Staroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systemsStaroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systems
 
intro-slides.pdf very important for computer science students
intro-slides.pdf very important for computer science studentsintro-slides.pdf very important for computer science students
intro-slides.pdf very important for computer science students
 
Ruby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVCRuby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVC
 
Model View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In AspnetModel View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In Aspnet
 
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate PerspectiveBridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate Perspective
 
Tdd,Ioc
Tdd,IocTdd,Ioc
Tdd,Ioc
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Service
 
Custom connector development using mule DevKit
Custom connector development using mule DevKitCustom connector development using mule DevKit
Custom connector development using mule DevKit
 
T2
T2T2
T2
 
JAX 08 - Agile RCP
JAX 08 - Agile RCPJAX 08 - Agile RCP
JAX 08 - Agile RCP
 
Bca5020 visual programming
Bca5020  visual programmingBca5020  visual programming
Bca5020 visual programming
 
Features of the Modern C++ 20
Features of the Modern C++ 20Features of the Modern C++ 20
Features of the Modern C++ 20
 
Angular 2 in-1
Angular 2 in-1 Angular 2 in-1
Angular 2 in-1
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
 
Advanced functional programing in Swift
Advanced functional programing in SwiftAdvanced functional programing in Swift
Advanced functional programing in Swift
 
Devoxx 2012 (v2)
Devoxx 2012 (v2)Devoxx 2012 (v2)
Devoxx 2012 (v2)
 

More from corehard_by

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...corehard_by
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...corehard_by
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотниковcorehard_by
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титовcorehard_by
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...corehard_by
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишковcorehard_by
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...corehard_by
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...corehard_by
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...corehard_by
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...corehard_by
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...corehard_by
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...corehard_by
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филоновcorehard_by
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukićcorehard_by
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakovacorehard_by
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухинcorehard_by
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...corehard_by
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019corehard_by
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019corehard_by
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019corehard_by
 

More from corehard_by (20)

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
 

Recently uploaded

Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessWSO2
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Tetracrom printing process for packaging with CMYK+
Tetracrom printing process for packaging with CMYK+Tetracrom printing process for packaging with CMYK+
Tetracrom printing process for packaging with CMYK+Antonio de Llamas
 
A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxatharvdev2010
 
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfHCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfROWELL MARQUINA
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...stockholm university
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
full stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdffull stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdfHulkTheDevil
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxKunal Gupta
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfROWELL MARQUINA
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023
THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023
THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023Joshua Flannery
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 

Recently uploaded (20)

Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Tetracrom printing process for packaging with CMYK+
Tetracrom printing process for packaging with CMYK+Tetracrom printing process for packaging with CMYK+
Tetracrom printing process for packaging with CMYK+
 
A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptx
 
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfHCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...The work to make the piecework work: An ethnographic study of food delivery w...
The work to make the piecework work: An ethnographic study of food delivery w...
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
full stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdffull stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdf
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptx
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdf
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023
THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023
THE STATE OF STARTUP ECOSYSTEM - INDIA x JAPAN 2023
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 

New C++ features for writing DSLs . Ivan Čukić. CoreHard Spring 2019

  • 1. New C++ features for writing DSLs CoreHard 2019, Minsk dr Ivan Čukić ivan@cukic.co http://cukic.co
  • 2. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End About me Independent trainer / consultant KDE developer Author of the ”Functional Programming in C++” book University lecturer 2
  • 3. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Disclaimer Make your code readable. Pretend the next person who looks at your code is a psychopath and they know where you live. Philip Wadler 3
  • 5. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Introduction select name from participants; <expr> ::= <var> | <lit> | <expr> <op> <expr> [a-zA-Z][a-zA-Z0-0_]* 5
  • 6. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End DSLs and C++ Limited: .something syntax Operators Braces and parentheses 6
  • 7. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Introduction <=> 7
  • 8. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Introduction <_/_~~*~~,,,,,___/,,,> 8
  • 10. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first user.name = ”Martha”; user.surname = ”Jones”; // exception! user.age = 42; 10
  • 11. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Copy-and-swap type& operator=(const type& value) { auto tmp = value; tmp.swap(*this); return *this; } 11
  • 12. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first auto tmp = user; tmp.name = ”Martha”; tmp.surname = ”Jones”; tmp.age = 42; tmp.swap(user); 12
  • 13. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first with(user) ( name = ”Martha”, surname = ”Jones”, age = 42 ); 13
  • 14. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first with(user)() operator= operator= operator= name "Martha" surname "Jones" age 42 14
  • 15. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first class transaction { public: transaction(user_t& user) Defines the object : m_user{user} the transaction will {} operate on void operator() (⋯) { ⋯ } private: A reference to the user_t& m_user; object }; 15
  • 16. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first class transaction { public: transaction(user_t& user) : m_user{user} {} void operator() (⋯) Call operator takes { a list of actions ⋯ to perform } private: user_t& m_user; }; 15
  • 17. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first with(user)() operator= operator= operator= name "Martha" surname "Jones" age 42 16
  • 18. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first template <typename Member, typename Value> struct update { update(Member member, Value value) : member{member} , value{std::move(value)} { } Member member; Value value; }; Note that the update structure does not know which object it will be updating. 17
  • 19. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first with(user)() operator= operator= operator= name "Martha" surname "Jones" age 42 18
  • 20. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first template <typename Member> struct field { field(Member member) : member{member} { } template <typename Value> update<Member, Value> operator=(Value&& value) const { return update{member, FWD(value)}; } Member member; }; 19
  • 21. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first field name{⋯}; field surname{⋯}; field age{⋯}; 20
  • 22. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first #define field(name) field_impl([] (auto& object) -> auto& { return object.name; }) with(user) ( field(name) = ”Martha”, field(surname) = ”Jones”, field(age) = 42 ); 21
  • 23. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first with(user)() operator= operator= operator= name "Martha" surname "Jones" age 42 22
  • 24. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first with(user)() operator= operator= operator= name "Martha" surname "Jones" age 42 23
  • 25. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Transaction We’ll model a simple transaction concept: The update action is activated using the call operator: Each update action returns a bool indicating success or failure. auto update_action{name = ”Martha”}; if (update_action(user)) { // success } 24
  • 26. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Transaction class transaction { public: template <typename... Updates> bool operator() (Updates&&... updates) { auto temp = m_user; Invoke each update action on the temp object, and swap temp and *this only if they all succeeded } }; 25
  • 27. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Transaction class transaction { public: template <typename... Updates> bool operator() (Updates&&... updates) { auto temp = m_user; if ((... && FWD(updates)(temp))) { temp.swap(m_user); return true; } return false; } }; 26
  • 28. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Basics first Ideal simple DSL: Context-free AST that fits semantics Uses only simple constructs 27
  • 30. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax service(42042) | transform(trim) | remove_if(&std::string::empty) | filter([] (const std::string& message) { return message[0] != '#'; }) | sink_to_cerr; 29
  • 31. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax operator| operator| operator| operator| 30
  • 32. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax template <typename... Nodes> class expression { template <typename Continuation> auto operator| (Continuation&& cont) && { ⋯ } }; 31
  • 33. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax std::function: type erasure is cool but slow. Use a right-associative operator »= to appease Haskell gods? 32
  • 34. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax std::function: type erasure is cool but slow. Expression templates to the rescue! 32
  • 35. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax template <typename... Nodes> class expression { template <typename Continuation> auto operator| (Continuation&& cont) && { return expression( std::tuple_cat( std::move(m_nodes), std::make_tuple(FWD(cont)))); } std::tuple<Nodes...> m_nodes; }; 33
  • 36. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax auto user_names = users | transform(&user_t::name); auto ignore_empty = transform(trim) | remove_if(&std::string::empty); user_names | ignore_empty | transform(string_to_upper); 34
  • 37. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax operator| operator| operator| operator| operator| operator| operator| operator| 35
  • 38. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax operator| operator| operator| operator| operator| operator| operator| operator| 36
  • 39. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Syntax Different meanings of operator| Wildly different types of operands (no inheritance tree) Arbitrary complex AST 37
  • 40. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Universal expression template <typename Left, typename Right> struct expression { Left left; Right right; }; <node> ::= <producer> | <consumer> | <trafo> | <expression> <expression> ::= <node> <|> <node> 38
  • 41. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Meta information Adding meta-information to classes: struct producer_node_tag {}; struct consumer_node_tag {}; struct transformation_node_tag {}; class filter_node { public: using node_type_tag = transformation_node_tag; }; 39
  • 42. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Meta information template <typename Node> using node_category = typename remove_cvref_t<Node>::node_type_tag; 40
  • 43. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Universal expression template <typename Tag, typename Left, typename Right> struct expression { using node_type_tag = Tag; Left left; Right right; }; 41
  • 44. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Meta information template < typename Node , typename Category = std::detected_t<node_category, Node> constexpr bool is_node() { if constexpr (!is_detected_v<node_category, Node>) { return false; } else if constexpr ( std::is_same_v<complete_pipeline_tag, Category>) { return false; } else { return true; } } 42
  • 45. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Restricting the pipe template < typename Left , typename Right , REQUIRE(is_node<Left>() && is_node<Right>()) > auto operator| (Left&& left, Right&& right) { ⋯ } 43
  • 46. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Restricting the pipe template < typename Left , typename Right , REQUIRE(is_node<Left>() && is_node<Right>()) > auto operator| (Left&& left, Right&& right) { if constexpr (!is_producer<Left> && !is_consumer<Right>) { return expression<transformation_node_tag, Left, Right>{ FWD(left), FWD(right) }; } ⋯ } 44
  • 47. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Restricting the pipe template < typename Left , typename Right , REQUIRE(is_node<Left>() && is_node<Right>()) > auto operator| (Left&& left, Right&& right) { ⋯ else if constexpr (is_producer<Left> && !is_consumer<Right>) { return expression<producer_node_tag, Left, Right>{ FWD(left), FWD(right) }; } ⋯ } 45
  • 48. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Restricting the pipe template < typename Left , typename Right , REQUIRE(is_node<Left>() && is_node<Right>()) > auto operator| (Left&& left, Right&& right) { ⋯ else if constexpr (!is_producer<Left> && is_consumer<Right>) { return expression<consumer_node_tag, Left, Right>{ FWD(left), FWD(right) }; } ⋯ } 46
  • 49. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Restricting the pipe template < typename Left , typename Right , REQUIRE(is_node<Left>() && is_node<Right>()) > auto operator| (Left&& left, Right&& right) { ⋯ else if constexpr (is_producer<Left> && is_consumer<Right>) { return expression<complete_pipeline_tag, Left, Right>{ FWD(left), FWD(right) }; } } 47
  • 51. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Evaluation operator| operator| operator| operator| operator| operator| operator| operator| 49
  • 52. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End AST transformation 1. Collect nodes from the left sub-tree 2. Collect nodes from the right sub-tree 3. Merge the results 50
  • 53. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End AST transformation template <typename Expr> auto collect_nodes(Expr&& expr) { auto collect_sub_nodes = [] (auto&& sub) { if constexpr (is_expression<decltype(sub)>) { return collect_nodes(std::move(sub)); } else { return std::make_tuple(std::move(sub)); } }; return std::tuple_cat( collect_sub_nodes(std::move(expr.left)), collect_sub_nodes(std::move(expr.right))); } 51
  • 54. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Evaluation Two choices: Connect left-to-right Connect right-to-left 52
  • 55. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End LTR Pros: Easier Easy to pass value_type around Cons: Type erasure 53
  • 56. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End RTL Pros: No need for type erasure Cons: No way to pass value_type: service(42042) | debounce<std::string>(200ms) | ... 54
  • 57. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Both! Feed forward and backward connect. 55
  • 58. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation struct transform_t { template <typename In> using value_type_for_input_t = ⋯ }; 56
  • 59. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation using new_value_type = typename Data::template value_type_for_input_t<ValueType>; 57
  • 60. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation template <typename LastValueType, typename... ProcessedNodes> struct folding_context { ⋯ }; 58
  • 61. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 62. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 63. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 64. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 65. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 66. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 67. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 68. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation 59
  • 69. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation template <typename... Nodes> auto propagate_value_type(Nodes&& ...nodes) { return (init_context() % ... % FWD(nodes)).nodes; } 60
  • 70. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation template <typename NodesTuple> auto propagate_value_type(NodesTuple&& nodes) { return (init_context() % ... % ???).nodes; } 61
  • 71. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation template <typename NodesTuple, size_t... Idx> auto propagate_value_type(NodesTuple&& nodes, std::index_sequence<Idx...>) { return (init_context() % ... % std::get<Idx>(FWD(nodes))).nodes; } 62
  • 72. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Context propagation propagate_value_type( nodes, std::make_index_sequence<std::tuple_size_v<Tuple>>() ); 63
  • 73. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Connection Now we have a list of enriched nodes, we can connect them right-to-left. 64
  • 74. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Evaluation template <typename... Nodes> auto evaluate_nodes(Nodes&&... nodes) { return (... % nodes); } 65
  • 75. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Connection template <typename Node, typename Connected> auto operator% (Node&& new_node, Connected&& connected) { return FWD(new_node).with_continuation(FWD(connected)); } 66
  • 77. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Asserts #define assert_value_type(T) static_assert( std::is_same_v<T, std::remove_cvref_t<T>>, ”This is not a value type”) 68
  • 78. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Printf debugging template <typename... Types> class print_types; print_types<std::vector<bool>::reference>{}; error: incomplete type 'class print_types<std::_Bit_reference>' 69
  • 79. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Printf debugging template <typename... Types> [[deprecated]] class print_types; 70
  • 80. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Printf debugging For complex expression template types, create a sanitization script: basic_string... → string transformation_node_tag → TRAFO Change all < and > into ( and ) and pass the output through clang-format. 71
  • 81. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Printf debugging expression( expression( void, expression(PRODUCER, expression(PRODUCER, ping_process, transform(”(λ tests_multiprocess.cpp:91:26)”)), transform(”(λ tests_multiprocess.cpp:82:38)”))), expression( TRAFO, expression(TRAFO, expression(TRAFO, expression(TRAFO, identity_fn, transform(”(λ tests_multiprocess.cpp:99: ⋯ 72
  • 82. © Ivan Čukić, 2019 Introduction Basics Context Evaluation Best practices The End Answers? Questions! Questions? Answers! Kudos (in chronological order): Friends at KDE Saša Malkov and Zoltan Porkolab Сергей Платонов Functional Programming in C++ cukic.co/to/fp-in-cpp 73