Crystal (programming language): Difference between revisions

Content deleted Content added
Undid revision 1188305666 by Theki (talk) Maybe it is needed actually
not needed when the title already contains the disambiguation
 
(11 intermediate revisions by 10 users not shown)
Line 1:
{{Short description|Object-oriented programming language}}
{{About|the [[programming language]]||Crystal (disambiguation)}}
{{Infobox programming language
| name = Crystal
Line 6 ⟶ 5:
| paradigm = [[Multi-paradigm programming language|Multi-paradigm]]: [[Object-oriented programming|object-oriented]], [[Concurrent computing|concurrent]]
| released = {{Start date and age|2014|06|19}}<ref>{{Cite web|url=https://crystal-lang.org/2014/06/19/crystal-0.1.0-released.html|title=Crystal 0.1.0 released!|website=crystal-lang|date=19 June 2014 }}</ref>
| designer = Joe Kohler, Ary Borenszweig, Juan Wajnerman, Brian Cardiff
| developer = Manas Technology Solutions
| latest release version = {{wikidata|property|editpreferred|Q21921428references|edit|P348|P548=Q2804309}}
| latest release date = {{startStart date and age|{{wikidata|qualifier|Q21921428preferred|single|P348|P548=Q2804309|P577}}|df=yes}}
| typing = [[Type system#Static type checking|static]], [[Type system#Inferred type checking|inferred]], [[Nominal type system|nominal]], [[Duck_typing|duck]]
| influenced by = [[Ruby (programming language)|Ruby]], [[C (programming language)|C]], [[Rust (programming language)|Rust]], [[Go (programming language)|Go]],<ref name="rel_0.18.0"/>go [[C Sharp (programming language)|C#]],<ref name=multithread"rel_0.18.0"/> [[Python (programming language)|Python]]<ref name="rel_0.18.0"/>
| programming language = Crystal
| platform = [[IA-32]] (i386), [[x86-64]], [[AArch64]]<ref name="platform-support" />
| operating system = [[Linux]], [[macOS]], [[FreeBSD]], [[OpenBSD]], [[Microsoft Windows|Windows]]<ref name="platform-support" />
| license = [[Apache License 2.0]]
| file ext = .cr
Line 28 ⟶ 27:
 
== Description ==
Although resembling the Ruby language in syntax, Crystal compiles to much more efficient native code using an [[LLVM]] backend, at the cost of precluding the dynamic aspects of Ruby. The advanced global type inference used by the Crystal compiler, combined with [[union type]]s, gives it more the feel of a higher-level scripting language than many other comparable programming languages. It has automated garbage collection and offers a [[Boehm garbage collector|Boehm collector]]. Crystal possesses a macro system and supports generics as well as method and operator overloading. Its concurrency model is inspired by [[communicating sequential processes]] (CSP) and implements lightweight fibers and channels (for interfiber communication), inspired by [[Go (programming language)|Go]].<ref name = "rel_0go multithread">{{cite web | url=https://forum.18crystal-lang.0"org/t/crystal-multithreading-support/6622/19 | title=Crystal multithreading support | date=23 February 2024 }}</ref>
 
== Examples ==
=== Hello World ===
This is the simplest way to write the [["Hello, World!" program|Hello World]] program in Crystal:
 
<syntaxhighlight lang="crystal">
Line 114 ⟶ 113:
puts value # => 2
</syntaxhighlight>
 
== Adoption ==
 
In 2020, it was reported that the infotainment units in vehicles produced by [[Nikola Corporation]] were written in Crystal.<ref>{{cite web |last1=Pettinati |first1=Martin |title=Nikola Motor Company: Crystal powered dashboards on the trucks of the future {{!}} Manas.Tech |url=https://manas.tech/blog/2020/02/11/nikola-motor-company/ |website=Manas Technology Solutions |language=en |date=11 February 2020}}</ref> Much of the backend of the [[Kagi (search engine)|Kagi search engine]] is written with Crystal.<ref>{{cite web |title=Zac Nowicki – Tales from Kagi {{!}} CrystalConf 2023 |url=https://www.youtube.com/watch?v=r7t9xPajjTM |date=13 November 2023}}</ref>
 
== Further reading ==
Line 169 ⟶ 172:
| via = [[GitHub]]
}}
</ref>
</ref>
<ref name="type-inference-i">
Line 203 ⟶ 205:
<ref name="why_crystal">
{{cite web
| url = httphttps://motion-expressadlerhsieh.com/blogp/why-use-crystal-lang
| title = Why Crystal programming language?
| last = Hsieh
| first = Adler
| date = September 20, 2015
| website = motion-expressadlerhsieh.com
}}
</ref>
Line 229 ⟶ 231:
| date = June 16, 2016
| website = crystal-lang.org
| quote =
| quote = It's heavily inspired by Ruby, and other languages (like C#, Go and Python).
}}
</ref>
Line 256 ⟶ 258:
[[Category:Cross-platform free software]]
[[Category:Cross-platform software]]
[[Category:Free compilers and interpretersopen source compilers]]
[[Category:Software using the Apache license]]
[[Category:Programming languages created in 2014]]