forked from crystal-lang/crystal-website
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
255 lines (236 loc) · 8.82 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
---
title: Crystal
layout: home
custom_body_classes:
- main
---
<div class="banner center sponsorship no-select">
<div class="flag">
Fund Crystal and help it keep growing at
<div class="flag-logos">
<a href="https://opencollective.com/crystal-lang" target="_blank">
<img src="/assets/oc.png" class="oc-logo">
</a>
</div>
</div>
</div>
<div class="container">
<div class="row center">
<div class="col s12">
{% assign latest_release = site.releases | reverse | first %}
<h2 class="latest-release">Latest release <a href="{{ latest_release.url }}">{{ latest_release.version }}</a></h2>
<p>{{ latest_release.date | date: "%d %B %Y" }} - <a href="/blog#release_notes" class="gray-link">More release notes</a></p>
</div>
</div>
<hr class="fullwidth" />
<div class="row">
<div class="col s12">
<h2>Syntax</h2>
<p>Crystal’s syntax is heavily inspired by Ruby’s, so it feels natural to read and easy to write, and has the
added benefit of a lower learning curve for experienced Ruby devs.</p>
<div class='code_section'>
{% include sample_server.md %}
</div>
<p class="read-more"><a href="https://crystal-lang.org/reference/getting_started/">Start learning Crystal with the Language
Reference</a></p>
</div>
</div>
<div class="row">
<div class="col s12">
<h2>Type system</h2>
<p>Crystal is statically type checked, so any type errors will be caught early by the compiler rather than fail on
runtime. Moreover, and to keep the language clean, Crystal has built-in type inference, so most type annotations
are unneeded.</p>
<div class="code_section">
{% include sample_type_system.md %}
</div>
<p class="read-more"><a href="https://crystal-lang.org/reference/syntax_and_semantics/types_and_methods.html">Read more
about Crystal's type system</a></p>
</div>
</div>
<div class="row">
<div class="col s12">
<h2>Null reference checks</h2>
<p>All types are non-nilable in Crystal, and nilable variables are represented as a union between the type and
nil. As a consequence, the compiler will automatically check for null references in compile time, helping
prevent the dreadful <a href="https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare" target="_blank">billion-dollar mistake</a>.</p>
<div class="code_section">
{% include sample_null.md %}
</div>
<p>Running the previous file:</p>
<div class="code_section">
<figure class="highlight console">
{% include sample_null_refs.html %}
</figure>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<h2>Macros</h2>
<p>Crystal’s answer to metaprogramming is a powerful macro system, which ranges from basic templating and AST
inspection, to types inspection and running arbitrary external programs.</p>
<div class="code_section">
{% include sample_macros.md %}
</div>
<p class="read-more"><a href="https://crystal-lang.org/reference/syntax_and_semantics/macros.html">Read more about
macros</a></p>
</div>
</div>
<div class="row">
<div class="col s12">
<h2>Concurrency Model</h2>
<p>Crystal uses green threads, called fibers, to achieve concurrency. Fibers communicate with each other using
channels, as in Go or Clojure, without having to turn to shared memory or locks. </p>
<div class="code_section">
{% include sample_concurrency.md %}
</div>
<p class="read-more"><a href="https://crystal-lang.org/reference/guides/concurrency.html">Read more about Crystal's
concurrency model</a></p>
</div>
</div>
<div class="row">
<div class="col s12">
<h2>C-bindings</h2>
<p>Crystal has a dedicated syntax to easily call native libraries, eliminating the need to reimplement low-level
tasks.</p>
<div class="code_section">
{% include sample_bindings.md %}
</div>
<p class="read-more"><a href="https://crystal-lang.org/reference/syntax_and_semantics/c_bindings/">Learn how to bind to
C libraries</a></p>
</div>
</div>
<div class="row">
<div class="col s12">
<h2>Dependencies</h2>
<p>Crystal libraries are packed as Shards, and distributed via Git without needing a centralised repository. Built
in commands allow dependencies to be easily specified through a YAML file and fetched from their respective
repositories.</p>
<div class="code_section">
{% include sample_dependencies.md %}
</div>
<p class="read-more"><a href="https://github.com/crystal-lang/shards">Read more about Shards in the repo</a></p>
</div>
</div>
<div class="row center">
<div class="col s12">
<div class="flag">
<h3>Crystal top sponsors</h3>
<a href="/sponsors">Meet all</a>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<div class='sponsors-list'>
<a href='https://manas.tech/' target='_blank' class="sponsor">
<img src="/assets/manas-orange.svg" />
<span class="small">Manas Technology Solutions</span>
</a>
<a href='https://www.84codes.com/' target='_blank' class="sponsor">
<img src="/assets/sponsors/84.png" />
<span class="small">84 codes</span>
</a>
<a href='https://nikolamotor.com/' target='_blank' class="sponsor">
<img src="/assets/sponsors/nikola_motor_company.png" />
<span class="small">Nikola Motor Company</span>
</a>
<a href='https://place.technology/' target='_blank' class="sponsor">
<img src="/assets/sponsors/placeos.png" />
<span class="small">PlaceOS</span>
</a>
</div>
</div>
</div>
<div class="row center">
<div class="col s12">
<div class="flag">
<h3>Some of our CI runs here</h3>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<div class='sponsors-list'>
<a href='https://developer.arm.com/solutions/infrastructure/works-on-arm' target='_blank' class="sponsor">
<img src="/assets/sponsors/woa.png" />
<span class="small">Works on Arm</span>
</a>
</div>
</div>
</div>
<hr class="fullwidth">
<div class="row">
<div class="col s12">
<h2>Articles from our blog</h2>
{% assign articles = site.posts %}
{% for post in articles limit: 3 %}
{% include blog_row.html post=post %}
{% endfor %}
<p><a href="/blog">More articles</a></p>
</div>
</div>
<div class="row">
<div class="col s12">
<h2>Release Notes</h2>
<table class="bordered no-underline">
<tbody>
{% assign releases = site.releases | reverse %}
{% for post in releases limit: 10 %}
<tr>
<td></td>
<td><a href="{{ post.url }}">
{{ post.title }}
</a></td>
<td>{{ post.date | date_to_string }}</td>
{% endfor %}
</tbody>
</table>
<p><a href="/blog#release_notes">More release notes</a></p>
</div>
</div>
<div class="row center">
<div class="col s12">
<div class="flag">
<h3>Community channels</h3>
<a href="/community">Show all</a>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<div class='row community-list center'>
<div class="col s12 m12 l3">
<a href='https://github.com/crystal-lang/crystal/' target='_blank' class="item">
<span class="small">Code repository</span>
<i class="extra-icons github"></i>
<span class="with_icon">crystal-lang/crystal</span>
</a>
</div>
<div class="col s12 m12 l3">
<a href='https://forum.crystal-lang.org' target='_blank' class="item">
<span class="small">General discussion</span>
<i class="material-icons">forum</i>
<span class="with_icon">forum.crystal-lang.org</span>
</a>
</div>
<div class="col s12 m12 l3">
<a href='https://gitter.im/crystal-lang/crystal' target='_blank' class="item">
<span class="small">Chat room</span>
<i class="extra-icons gitter"></i>
<span class="with_icon">crystal-lang/crystal</span>
</a>
</div>
<div class="col s12 m12 l3">
<a href='https://twitter.com/CrystalLanguage' target='_blank' class="item">
<span class="small">General announcements and events</span>
<i class="extra-icons twitter"></i>
<span class="with_icon">@CrystalLanguage</span>
</a>
</div>
</div>
</div>
</div>
</div>
<script src="https://d3js.org/d3.v3.min.js"></script>