-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
crystal.scroll
264 lines (225 loc) · 6.95 KB
/
crystal.scroll
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
256
257
258
259
260
261
262
263
264
import ../code/conceptPage.scroll
id crystal
name Crystal
appeared 2014
creators Ary Borenszweig and Juan Wajnerman and Brian Cardiff
tags pl
website https://crystal-lang.org
blog https://crystal-lang.org/blog/
releaseNotes https://github.com/crystal-lang/crystal/blob/master/CHANGELOG.md
latestVersion 1.12.1
webRepl https://play.crystal-lang.org/#/cr
isOpenSource true
writtenIn crystal ecr yaml markdown html javascript powershell bourne-shell css c svg make xml python json z-shell bash cpp nix ini
tryItOnline crystal
fileExtensions cr
clocExtensions cr
fileType text
wordRank 2716
documentation https://crystal-lang.org/reference/1.6/index.html
documentation https://devdocs.io/crystal/
faq https://forum.crystal-lang.org/
rosettaCode http://www.rosettacode.org/wiki/Category:Crystal
centralPackageRepositoryCount 0
repoStats
firstCommit 2012
commits 16193
committers 638
files 2304
newestCommit 2024
country Argentina and Germany and Turkey
originCommunity https://forum.crystal-lang.org/
projectEuler Crystal
memberCount
2019 5
2022 14
helloWorldCollection Crystal
# Hello world in Crystal
puts "Hello World"
pygmentsHighlighter Crystal
filename crystal.py
fileExtensions cr
rijuRepl https://riju.codes/crystal
example
puts "Hello, world!"
description General-purpose, object-oriented programming language with syntax inspired by the language Ruby
fileExtensions cr
website https://crystal-lang.org/
gitRepo https://github.com/crystal-lang/crystal
subreddit https://reddit.com/r/crystal_programming
memberCount
2022 4118
twitter https://twitter.com/crystallanguage
leachim6 Crystal
filepath c/Crystal.cr
fileExtensions cr
example
puts "Hello World"
gource https://www.youtube.com/watch?v=YToY_0fhEzc
languageServerProtocolProject https://github.com/kofno/scry
writtenIn crystal
compilerExplorer Crystal
example
# Type your code here, or load an example.
# compile with --prelude=empty
fun square(num : Int32) : Int32
num &* num
end
keywords abstract do if nil? self unless alias else in of sizeof until as elsif include out struct when as? end instance_sizeof pointerof super while asm ensure is_a? private then with begin enum lib protected true yield break extend macro require type case false module rescue typeof class for next return uninitialized def fun nil select union
githubRepo https://github.com/crystal-lang/crystal
stars 17909
forks 1367
subscribers 416
created 2012
updated 2022
firstCommit 2012
description The Crystal Programming Language
issues 1520
lineCommentToken #
printToken puts
stringToken "
booleanTokens true false
includeToken require
hasTypeInference true
hasLineComments true
# A comment
hasComments true
# A comment
hasMultiLineComments false
hasPrintDebugging true
hasSemanticIndentation false
hasStrings true
"Hello world"
hasBooleans true
hasImports true
require "../../spec_helper"
hasClasses true
hasFunctions true
hasConditionals true
hasWhileLoops true
wikipedia https://en.wikipedia.org/wiki/Crystal_(programming_language)
example
channel = Channel(Int32).new
spawn do
puts "Before first send"
channel.send(1)
puts "Before second send"
channel.send(2)
end
puts "Before first receive"
value = channel.receive
puts value # => 1
puts "Before second receive"
value = channel.receive
puts value # => 2
related ia-32 freebsd ruby c rust go csharp python llvmir csp
summary In computer software programming languages, Crystal is a general-purpose, object-oriented programming language, designed and developed by Ary Borenszweig and Juan Wajnerman and more than 200 contributors. With syntax inspired by the language Ruby, it is a compiled language with static type-checking, but specifying the types of variables or method arguments is generally unneeded. Types are resolved by an advanced global type inference algorithm. Crystal is in active development. It is released as free and open-source software under the Apache License version 2.0
pageId 48972626
dailyPageViews 143
created 2016
backlinksCount 31
revisionCount 95
appeared 2014
fileExtensions cr
tiobe Crystal
currentRank 24
domainName crystal-lang.org
registered 2013
awisRank
2022 387907
2017 299324
githubBigQuery Crystal
repos 1197
users 767
linguistGrammarRepo https://github.com/atom-crystal/language-crystal
firstCommit 2013
lastCommit 2018
committerCount 47
commitCount 320
sampleCount 3
example
#!/usr/bin/env bin/crystal --run
require "../../spec_helper"
describe "Type inference: declare var" do
it "types declare var" do
assert_type("a :: Int32") { int32 }
end
it "types declare var and reads it" do
assert_type("a :: Int32; a") { int32 }
end
it "types declare var and changes its type" do
assert_type("a :: Int32; while 1 == 2; a = 'a'; end; a") { union_of(int32, char) }
end
it "declares instance var which appears in initialize" do
result = assert_type("
class Foo
@x :: Int32
end
Foo.new") { types["Foo"] }
mod = result.program
foo = mod.types["Foo"] as NonGenericClassType
foo.instance_vars["@x"].type.should eq(mod.int32)
end
it "declares instance var of generic class" do
result = assert_type("
class Foo(T)
@x :: T
end
Foo(Int32).new") do
foo = types["Foo"] as GenericClassType
foo_i32 = foo.instantiate([int32] of Type | ASTNode)
foo_i32.lookup_instance_var("@x").type.should eq(int32)
foo_i32
end
end
it "declares instance var of generic class after reopen" do
result = assert_type("
class Foo(T)
end
f = Foo(Int32).new
class Foo(T)
@x :: T
end
f") do
foo = types["Foo"] as GenericClassType
foo_i32 = foo.instantiate([int32] of Type | ASTNode)
foo_i32.lookup_instance_var("@x").type.should eq(int32)
foo_i32
end
end
it "declares an instance variable in initialize" do
assert_type("
class Foo
def initialize
@x :: Int32
end
def x
@x
end
end
Foo.new.x
") { int32 }
end
end
isbndb 0
githubLanguage Crystal
fileExtensions cr
trendingProjects
author name avatar url language languageColor stars forks currentPeriodStars description
omarroth invidious https://github.com/omarroth.png https://github.com/omarroth/invidious Crystal #000100 1184 86 154 "Invidious is an alternative front-end to YouTube"
crystal-lang crystal https://github.com/crystal-lang.png https://github.com/crystal-lang/crystal Crystal #000100 13807 1071 172 "The Crystal Programming Language"
trendingProjectsCount 3
type programming
interpreters crystal
aceMode ruby
codemirrorMode crystal
codemirrorMimeType text/x-crystal
tmScope source.crystal
repos 7522
stackOverflowSurvey
2021
users 466
medianSalary 72400
fans 790
percentageUsing 0.01
semanticScholar 0