SlideShare a Scribd company logo
Downtown Ruby Group May 2016Adrian Madrid
CRYSTAL LANG
friendly, static, modern, compiled
TL;DR VERY COOL
Adrian Madrid Downtown Ruby Group May 2016
FRIENDLY SYNTAX
def fibonacci(n)
return n if n <= 1
fibonacci(n - 1) + fibonacci(n - 2)
end
number = (ARGV[0]? || "40").to_i
puts "Calculating fibonacci for: #{number}"
puts fibonacci(number)
RUBY MOSTLY
Adrian Madrid Downtown Ruby Group May 2016
STATIC TYPE CHECKING
➤ All the benefits of static typing
➤ While figuring it all out on its own, mostly
DOH CHECKING
def foo(arg)
arg + 1
end
a = rand(2) == 0 ? 1 : nil
puts foo(a)
Adrian Madrid Downtown Ruby Group May 2016
MODERN STANDARD LIBRARY
➤ Spec (like RSpec)
➤ CSV, JSON, XML, YAML, Markdown
➤ HTTP Client & Server (WebSocket too)
➤ OAuth & OAuth2
➤ SecureRandom, Levenstein, HTML Builder, etc.
NEW STUFF
Adrian Madrid Downtown Ruby Group May 2016
COMPILES INTO FAST NATIVE CODE MICRO SECOND FAST
require “http/server”; require "http/server/handler"
host = "0.0.0.0"
port = 8080
handlers = [
HTTP::ErrorHandler.new,
HTTP::LogHandler.new,
HTTP::StaticFileHandler.new(“.")
]
server = HTTP::Server.new(host,port, handlers) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello world!"
end
puts "Listening on http://0.0.0.0:8080"
server.listen
$ crystal build —release http_server.rb
$ ./http_server
Listening on http://0.0.0.0:8080
GET / - 200 (725µs)
GET / - 200 (82µs)
GET / - 200 (57µs)
Adrian Madrid Downtown Ruby Group May 2016
MACROS PRE-COMPILE METAPROGRAMMING
macro define_method(name, content)
def {{name}}
{{content}}
end
end
# This generates:
# def foo
# 1
# end
define_method foo, 1
foo #=> 1
Adrian Madrid Downtown Ruby Group May 2016
SELF HOSTED
➤ Compiled and linked
➤ You can cross-compile too
98.2% IN CRYSTAL
Adrian Madrid Downtown Ruby Group May 2016
LINKS
➤ Language - http://crystal-lang.org/
➤ API - http://crystal-lang.org/api/
➤ Code - https://github.com/manastech/crystal
➤ Docs - http://crystal-lang.org/docs/
➤ Libraries - http://awesome-crystal.com/
GO CHECK IT OUT
Adrian Madrid Downtown Ruby Group May 2016
http://crystal-lang.org/
Adrian Madrid Downtown Ruby Group May 2016

More Related Content

PDF
How to write Ruby extensions with Crystal
Anna (gaar4ica) Shcherbinina
 
PDF
DZone%20-%20Essential%20Ruby
tutorialsruby
 
PDF
DZone%20-%20Essential%20Ruby
tutorialsruby
 
PPTX
Ruby And Ruby On Rails
AkNirojan
 
PDF
Ruby Presentation
platico_dev
 
PDF
IJTC%202009%20JRuby
tutorialsruby
 
PDF
IJTC%202009%20JRuby
tutorialsruby
 
How to write Ruby extensions with Crystal
Anna (gaar4ica) Shcherbinina
 
DZone%20-%20Essential%20Ruby
tutorialsruby
 
DZone%20-%20Essential%20Ruby
tutorialsruby
 
Ruby And Ruby On Rails
AkNirojan
 
Ruby Presentation
platico_dev
 
IJTC%202009%20JRuby
tutorialsruby
 
IJTC%202009%20JRuby
tutorialsruby
 

Similar to Crystal lightning talk - drug 2016 (20)

PDF
Ruby confhighlights
Claire Tran
 
PDF
Crystal
Kamil Lelonek
 
KEY
Ruby v cpp_preso
jessicard
 
PPTX
Ruby for PHP developers
Max Titov
 
PDF
The details of CI/CD environment for Ruby
Hiroshi SHIBATA
 
PDF
The Crystal language *recently* update
karupanerura
 
DOCX
Page List & Sample Material (Repaired)
Muhammad Haseeb Shahid
 
KEY
Learn Ruby 2011 - Session 1
James Thompson
 
PDF
0201710897
guru50
 
ODP
Ruby
Aizat Faiz
 
KEY
Introducing Ruby
James Thompson
 
PPTX
Why ruby
Bill Chea
 
PDF
10 Things you should know about Ruby
sikachu
 
PPTX
Introduction to Ruby Native Extensions and Foreign Function Interface
Oleksii Sukhovii
 
PDF
The Joy Of Ruby
Clinton Dreisbach
 
PPTX
Go from a PHP Perspective
Barry Jones
 
PPTX
Ruby Programming Language - Introduction
Kwangshin Oh
 
PDF
Building Modern Applications in Ruby: Fast, Efficient, Versatile, and Cost-Ef...
Marylene Sawyer
 
PPTX
Ruby -the wheel Technology
ppparthpatel123
 
PDF
ruby-cocoa
tutorialsruby
 
Ruby confhighlights
Claire Tran
 
Crystal
Kamil Lelonek
 
Ruby v cpp_preso
jessicard
 
Ruby for PHP developers
Max Titov
 
The details of CI/CD environment for Ruby
Hiroshi SHIBATA
 
The Crystal language *recently* update
karupanerura
 
Page List & Sample Material (Repaired)
Muhammad Haseeb Shahid
 
Learn Ruby 2011 - Session 1
James Thompson
 
0201710897
guru50
 
Introducing Ruby
James Thompson
 
Why ruby
Bill Chea
 
10 Things you should know about Ruby
sikachu
 
Introduction to Ruby Native Extensions and Foreign Function Interface
Oleksii Sukhovii
 
The Joy Of Ruby
Clinton Dreisbach
 
Go from a PHP Perspective
Barry Jones
 
Ruby Programming Language - Introduction
Kwangshin Oh
 
Building Modern Applications in Ruby: Fast, Efficient, Versatile, and Cost-Ef...
Marylene Sawyer
 
Ruby -the wheel Technology
ppparthpatel123
 
ruby-cocoa
tutorialsruby
 
Ad

Recently uploaded (20)

PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PDF
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PPTX
Presentation about variables and constant.pptx
kr2589474
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PPTX
Presentation about Database and Database Administrator
abhishekchauhan86963
 
PDF
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
PDF
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PDF
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PDF
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
Presentation about variables and constant.pptx
kr2589474
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
oapresentation.pptx
mehatdhavalrajubhai
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
Presentation about Database and Database Administrator
abhishekchauhan86963
 
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
Ad

Crystal lightning talk - drug 2016

  • 1. Downtown Ruby Group May 2016Adrian Madrid CRYSTAL LANG friendly, static, modern, compiled
  • 2. TL;DR VERY COOL Adrian Madrid Downtown Ruby Group May 2016
  • 3. FRIENDLY SYNTAX def fibonacci(n) return n if n <= 1 fibonacci(n - 1) + fibonacci(n - 2) end number = (ARGV[0]? || "40").to_i puts "Calculating fibonacci for: #{number}" puts fibonacci(number) RUBY MOSTLY Adrian Madrid Downtown Ruby Group May 2016
  • 4. STATIC TYPE CHECKING ➤ All the benefits of static typing ➤ While figuring it all out on its own, mostly DOH CHECKING def foo(arg) arg + 1 end a = rand(2) == 0 ? 1 : nil puts foo(a) Adrian Madrid Downtown Ruby Group May 2016
  • 5. MODERN STANDARD LIBRARY ➤ Spec (like RSpec) ➤ CSV, JSON, XML, YAML, Markdown ➤ HTTP Client & Server (WebSocket too) ➤ OAuth & OAuth2 ➤ SecureRandom, Levenstein, HTML Builder, etc. NEW STUFF Adrian Madrid Downtown Ruby Group May 2016
  • 6. COMPILES INTO FAST NATIVE CODE MICRO SECOND FAST require “http/server”; require "http/server/handler" host = "0.0.0.0" port = 8080 handlers = [ HTTP::ErrorHandler.new, HTTP::LogHandler.new, HTTP::StaticFileHandler.new(“.") ] server = HTTP::Server.new(host,port, handlers) do |context| context.response.content_type = "text/plain" context.response.print "Hello world!" end puts "Listening on http://0.0.0.0:8080" server.listen $ crystal build —release http_server.rb $ ./http_server Listening on http://0.0.0.0:8080 GET / - 200 (725µs) GET / - 200 (82µs) GET / - 200 (57µs) Adrian Madrid Downtown Ruby Group May 2016
  • 7. MACROS PRE-COMPILE METAPROGRAMMING macro define_method(name, content) def {{name}} {{content}} end end # This generates: # def foo # 1 # end define_method foo, 1 foo #=> 1 Adrian Madrid Downtown Ruby Group May 2016
  • 8. SELF HOSTED ➤ Compiled and linked ➤ You can cross-compile too 98.2% IN CRYSTAL Adrian Madrid Downtown Ruby Group May 2016
  • 9. LINKS ➤ Language - http://crystal-lang.org/ ➤ API - http://crystal-lang.org/api/ ➤ Code - https://github.com/manastech/crystal ➤ Docs - http://crystal-lang.org/docs/ ➤ Libraries - http://awesome-crystal.com/ GO CHECK IT OUT Adrian Madrid Downtown Ruby Group May 2016