-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
208 lines (137 loc) · 4.62 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html>
<head>
<title>Elchemy Report</title>
<meta charset="utf-8">
<link rel="shortcut icon" href="img/favicon.ico"/>
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<textarea id="source">
name: problem
.left-column[
### BEAM langs
]
.right-column[
- erlang (1985) strong / dynamic types
- elixir (2011) strong / dynamic types
- [other 20+](https://github.com/llaisdy/beam_languages) dead or alive **dynamic** typed languages
]
---
template: problem
.right-column.center[
##### Dynamic typing is ...
]
---
template: problem
.right-column.center[
##### Dynamic typing is pain
<img src="img/dynamic-typing-meme.jpeg" width="88%">
]
---
.left-column[
### BEAM langs
### Elchemy
]
.right-column[
.center[
### [Elchemy](https://wende.github.io/elchemy/)
]
- founded by [Christopher Wende](https://github.com/wende)
- since 2017
- subset of elm (haskell)
- Hindley–Milner type system (type inference etc)
- generates readable elixir source code
.center[
<img src="img/elm-logo.png" width="50%">
]
]
---
.left-column[
### BEAM langs
### Elchemy
### Experiment
]
.right-column[
.center[
### [Concept](https://github.com/tim2CF/elchemy_poker) of poker game engine
#### reasons
]
- Elm (Haskell) is good to build pure business logic
- Elchemy officialy not support side-effects
- Cannot use enterprise OTP / Phoenix / Ecto stuff
<br><br>
.center[
So, we can say that Elchemy is good to write safe solid pieces of pure business logic. Pure functions without side-effects like this task.
]
]
---
.left-column[
### BEAM langs
### Elchemy
### Experiment
### Advantages
]
.right-column[
- It's [easy](https://github.com/wende/elchemy/blob/4112523266c245a10a7aad987753241eb97074a5/README.md#troubleshooting) to use Elchemy inside existing Elixir codebase
- Natural representation of types / business models
- [example 1](https://github.com/tim2CF/elchemy_poker/blob/6f975bfd0b6c3ca20a507ade19a83a9027ad7817/elm/elchemyPoker/models/Card.elm#L4-L7)
- [example 2](https://github.com/tim2CF/elchemy_poker/blob/6f975bfd0b6c3ca20a507ade19a83a9027ad7817/elm/elchemyPoker/models/Combo.elm#L5-L16)
- **STRONG STATIC types**
- 100% safe runtime inside Elchemy - generated code
- It's not possible to throw [exception](https://github.com/tim2CF/elchemy_poker/blob/6f975bfd0b6c3ca20a507ade19a83a9027ad7817/elm/elchemyPoker/models/Combo.elm#L28-L29)
- No any implicit [stuff](https://github.com/tim2CF/elchemy_poker/blob/6f975bfd0b6c3ca20a507ade19a83a9027ad7817/elm/elchemyPoker/models/Combo.elm#L33)
- No needed FFI to call from Elixir
- [Simple](https://github.com/tim2CF/elchemy_poker/blob/6f975bfd0b6c3ca20a507ade19a83a9027ad7817/elm/elchemyPoker/Utils.elm#L7) FFI for Elixir calls from Elchemy
- Auto generated Elixir [specs](https://github.com/tim2CF/elchemy_poker/blob/6f975bfd0b6c3ca20a507ade19a83a9027ad7817/lib/elchemy_poker/Utils.elchemy.ex#L43) (for Dialyzer and kind of documentation)
]
---
.left-column[
### BEAM langs
### Elchemy
### Experiment
### Advantages
### Disadvantages
]
.right-column[
- Meta programming is not supported
- No OTP / Phoenix / Ecto enterprise goodies (yet?)
- Maintained by only one [person](https://github.com/wende/elchemy/issues)
- Haskell-like currying in [generated code](https://wende.github.io/elchemy-ivy/calling-elchemy.html)
- In some cases performance is slower up to 15%
- FFI calls are not 100% safe (up to developer)
]
---
.left-column[
### BEAM langs
### Elchemy
### Experiment
### Advantages
### Disadvantages
### Results
]
.right-column[
- Elchemy compiler is pretty raw
- Concept was not completed because of compiler issues
- [type aliases](https://github.com/wende/elchemy/issues/245)
- [source code naming policy](https://github.com/wende/elchemy/issues/246)
- [Elm case to Elixir function clause](https://github.com/wende/elchemy/issues/247)
- [type aliases representation in Elixir](https://github.com/wende/elchemy/issues/251)
- [excess of currying in generated Elixir source code](https://github.com/wende/elchemy/issues/218)
- Christopher is very responsive guy, he fixed almost all issues and released new 0.5.4 version of Elchemy compiler **in 1 day**!
- Christopher needs your (as user and developer) help to improve compiler
- Elchemy compiler still looks very perspective
- It's good opportunity for Elixir developers to learn Elm
- Maybe it's nice to have a look to other static-typed BEAM language [Alpaca](https://github.com/alpaca-lang)
]
---
class: center, middle
# Thanks
</textarea>
<script src="js/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
</script>
</body>
</html>