Clever Geek Handbook
📜 ⬆️ ⬇️

Crystal (programming language)

Crystal is a general purpose object-oriented language designed and developed by Ary Borenszweig and Juan Wajnerman. [3] Crystal is statically typed and has Ruby-like syntax. The first official release of the language took place in June 2014. [4] [5] Initially, the language compiler was written in Ruby, until in 2013 it was rewritten in Crystal. [6] The language is under active development.

Crystal
Crystal language logo.svg
Language classmultiparadigmal : object oriented
Appeared in
AuthorAry borenszweig
DeveloperManas technology solutions
File extension
Release
Type systemStatic
InfluencedRuby , Go
LicenseApache License 2.0
PlatformIA-32 (i386), x86-64
OSLinux , macOS (Homebrew) [2]
Site

Content

Description

Despite the similarities in syntax, Crystal is much more efficient than Ruby in compiling to machine code using LLVM , sacrificing dynamic aspects of the language. According to the test results, Crystal shows similar performance with the C language. [7] [8] [9] The language uses the Boehm garbage collector , has a macro system, supports generics, as well as overloading methods and operators.

Crystal implements an interface for calling functions from binary libraries in C, C ++, etc., while the syntax for interacting with such libraries is maximally simplified, which makes it easy to create wrapper libraries, rather than writing all the code from scratch. Crystal also supports assembler inserts and direct pointer access - this is considered unsafe, but it is not forbidden, since it is necessary, in particular, for interacting with functions from external libraries.

Examples

Hello world!

The simplest spelling:

  puts "Hello World!"

In an object oriented style:

  class greeter
   def initialize (@name)
   end

   def salute
     "Hello # {@ name}!"
   end
 end
  g = Greeter.new ("world")
 puts g.salute

HTTP Server

  require "http / server"
  server = HTTP :: Server.new do | context |
   context.response.content_type = "text / plain"
   context.response.print "Hello world!"
 end
  server.bind_tcp 8080
 puts "Listening on http://127.0.0.1:8080"
 server.listen

Links

  1. ↑ Release 0.30.1 - 2019.
  2. ↑ InstallationGitBook
  3. ↑ crystal-lang / crystal (neopr.) . Github Date of treatment February 18, 2016.
  4. ↑ Crystal (neopr.) . crystal-lang.org. Date of treatment February 18, 2016.
  5. ↑ Why Crystal programming language? | Motion Express | Ruby, Rails, Crystal & developers' techniques (neopr.) . motion-express.com. Date of treatment February 18, 2016.
  6. ↑ Crystal (neopr.) . crystal-lang.org. Date of treatment February 18, 2016.
  7. ↑ kostya / benchmarks (neopr.) . Github Date of treatment February 18, 2016.
  8. ↑ kostya / crystal-benchmarks-game (unopened) . Github Date of treatment February 18, 2016.
  9. ↑ smarr / are-we-fast-yet (unspecified) . Github Date of treatment February 18, 2016.

[one]

  1. ↑ Release 0.25.1 (English) . Github Date of treatment June 28, 2018.
Source - https://ru.wikipedia.org/w/index.php?title=Crystal_(programming language)&oldid = 98859863


More articles:

  • Governor of the Transbaikal Territory
  • KPM-1
  • Levinger, Moshe
  • Dosychev, Vladimir Tikhonovich
  • Seliba (Minsk region)
  • Sigala
  • Burna Buriash I
  • Sifran
  • Krol, Thomas
  • Justice League (animated series)

All articles

Clever Geek | 2019