SlideShare a Scribd company logo
Buenos Aires - Crystal Meetup #1
¿Por qué Crystal? Ary Borenszweig
aborenszweig@manas.com.ar
¿Por qué un lenguaje nuevo?
Poca ceremonia
# Crystal
puts “Hello world”
~~~
// Java
public class Main {
public static void main(String[] args) {
System.out.println(“Hola mundo!”);
}
}
Fácil de leer y escribir
Fácil de leer y escribir
def say_hello()
puts(“Hola mundo!”);
end
say_hello();
Fácil de leer y escribir
def say_hello()
puts(“Hola mundo!”)
end
say_hello()
Fácil de leer y escribir
def say_hello()
puts “Hola mundo!”
end
say_hello()
Fácil de leer y escribir
def say_hello
puts “Hola mundo!”
end
say_hello
Apariencia de un lenguaje dinámico
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(100_000)
Eficiente
Eficiente
Tiempo (s) Memoria (MB)
C++ 5.08 1.1
Crystal 6.97 1.3
Ruby 226.86 8.0
Brainfuck
https://github.com/kostya/benchmarks
Eficiente
Tiempo (s) Memoria (MB)
Crystal 15.87 398.1
C++ 17.72 174.5
Python 396.54 724.0
Havlak
https://github.com/kostya/benchmarks
Eficiente
Tiempo (s) Memoria (MB)
Crystal 0.59 3.3
Go 1.43 2.3
Erlang 1.89 17.1
Ruby 41.73 30.0
Threadring
https://github.com/kostya/crystal-benchmarks-game
Eficiente
Tiempo (relativo)
Java 1.8.0_66 1.00
Crystal 1.58
Ruby MRI 2.3 47.59
Are we fast yet?
http://stefan-marr.de/downloads/crystal.html
Chequeo de tipos
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(100_000)
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(“Ups”)
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(“Ups”) # Error: no overload matches
# `Int32#<` with type String
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(“Ups”) # Error: no overload matches
# `Int32#<` with type String
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(“Ups”) # Error: no overload matches
# `Int32#<` with type String
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(100_000)
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n : Int)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(100_000)
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n : Int)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(“Ups”)
Chequeo de tipos
def prime?(n)
(2..n).all? { |i| n % i != 0 }
end
def sexy_primes(n : Int)
(9..n).map { |i| {i - 6, i} }
.select { |i| i.all? { prime?(i) } }
end
puts sexy_primes(“Ups”) # Error: no overload matches
# `sexy_primes` with type String
Alto nivel
numbers = [1, 2, 3, 4]
puts numbers.map { |x| x + 10 } # => [11, 12, 13, 14]
puts numbers[0] + numbers[-1] # => 5
phones = {
“Ary” => “15512312312”,
“Brian” => “1545645645”,
“Juan” => “1578978978”,
}
puts phones[“Brian”] # => “1545645645”
Bajo nivel
ptr = Pointer(UInt8).malloc(20)
ptr.value = 10_u8
puts ptr # => Pointer(UInt8)@0x109303e00
a = 1
ptr = pointerof(a)
ptr.value = 2
puts a # => 2
buffer = uninitialized UInt8[1024]
Bajo nivel
lib LibC
fun rand : LibC::Int
end
puts LibC.rand # => 16807
¿Por qué un lenguaje nuevo?
❖ Poca ceremonia
❖ Fácil de leer y escribir
❖ Apariencia de un lenguaje dinámico
❖ Eficiente
❖ Chequeo de tipos
❖ Alto y bajo nivel
❖ => Felicidad!
¿Para qué sirve?
Aplicaciones de consola
❖ tlcr: https://github.com/porras/tlcr
❖ crul: https://github.com/porras/crul
❖ vicr: https://github.com/veelenga/vicr
❖ shards: https://github.com/ysbaddaden/shards
Emuladores
❖ nes.cr: https://github.com/romeroadrian/nes.cr
❖ rcpu: https://github.com/ddfreyne/rcpu
Juegos
❖ crsfml: https://github.com/BlaXpirit/crsfml
❖ crystal-gl: https://github.com/ggiraldez/crystal-gl
Páginas web
❖ crystalshards: https://github.com/zamith/
crystalshards
❖ play.crystal-lang.org: https://github.com/jhass/carc.in
Bots IRC
❖ DeBot: https://github.com/jhass/DeBot
Compiladores
❖ Crystal: https://github.com/manastech/crystal
¡Gracias!
Ary Borenszweig
email: aborenszweig@manas.com.ar
@asteritetwitter:

More Related Content

Similar to Por qué Crystal? Why Crystal Language?

Python slide
Python slidePython slide
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Aleksandar Prokopec
 
Ruby on rails presentation
Ruby on rails presentationRuby on rails presentation
Ruby on rails presentation
Synbioz
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
Aslak Hellesøy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
Aslak Hellesøy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
Aslak Hellesøy
 
Python Basic
Python BasicPython Basic
Python Basic
Adityamelia Permana
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
Intermediate Swift Language by Apple
Intermediate Swift Language by AppleIntermediate Swift Language by Apple
Intermediate Swift Language by Apple
jamesfeng2
 
Retos de Programación en Python
Retos de Programación en PythonRetos de Programación en Python
Retos de Programación en Python
Javier Abadía
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
William Narmontas
 
Bulletproofing your foot for Kotlin
Bulletproofing your foot for KotlinBulletproofing your foot for Kotlin
Bulletproofing your foot for Kotlin
Enrique Zamudio López
 
Ruby Intro {spection}
Ruby Intro {spection}Ruby Intro {spection}
Ruby Intro {spection}
Christian KAKESA
 
Swift School #1
Swift School #1Swift School #1
Swift School #1
Sergey Pronin
 
Ruby 程式語言綜覽簡介
Ruby 程式語言綜覽簡介Ruby 程式語言綜覽簡介
Ruby 程式語言綜覽簡介
Wen-Tien Chang
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
Swift Study #7
Swift Study #7Swift Study #7
Swift Study #7
chanju Jeon
 
Introduction to Perl Best Practices
Introduction to Perl Best PracticesIntroduction to Perl Best Practices
Introduction to Perl Best Practices
José Castro
 

Similar to Por qué Crystal? Why Crystal Language? (20)

Python slide
Python slidePython slide
Python slide
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Ruby on rails presentation
Ruby on rails presentationRuby on rails presentation
Ruby on rails presentation
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Python Basic
Python BasicPython Basic
Python Basic
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Intermediate Swift Language by Apple
Intermediate Swift Language by AppleIntermediate Swift Language by Apple
Intermediate Swift Language by Apple
 
Retos de Programación en Python
Retos de Programación en PythonRetos de Programación en Python
Retos de Programación en Python
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
 
Bulletproofing your foot for Kotlin
Bulletproofing your foot for KotlinBulletproofing your foot for Kotlin
Bulletproofing your foot for Kotlin
 
Ruby Intro {spection}
Ruby Intro {spection}Ruby Intro {spection}
Ruby Intro {spection}
 
Swift School #1
Swift School #1Swift School #1
Swift School #1
 
Ruby 程式語言綜覽簡介
Ruby 程式語言綜覽簡介Ruby 程式語言綜覽簡介
Ruby 程式語言綜覽簡介
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
Swift Study #7
Swift Study #7Swift Study #7
Swift Study #7
 
Introduction to Perl Best Practices
Introduction to Perl Best PracticesIntroduction to Perl Best Practices
Introduction to Perl Best Practices
 

Recently uploaded

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 

Recently uploaded (20)

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 

Por qué Crystal? Why Crystal Language?

  • 1. Buenos Aires - Crystal Meetup #1 ¿Por qué Crystal? Ary Borenszweig aborenszweig@manas.com.ar
  • 2. ¿Por qué un lenguaje nuevo?
  • 3. Poca ceremonia # Crystal puts “Hello world” ~~~ // Java public class Main { public static void main(String[] args) { System.out.println(“Hola mundo!”); } }
  • 4. Fácil de leer y escribir
  • 5. Fácil de leer y escribir def say_hello() puts(“Hola mundo!”); end say_hello();
  • 6. Fácil de leer y escribir def say_hello() puts(“Hola mundo!”) end say_hello()
  • 7. Fácil de leer y escribir def say_hello() puts “Hola mundo!” end say_hello()
  • 8. Fácil de leer y escribir def say_hello puts “Hola mundo!” end say_hello
  • 9. Apariencia de un lenguaje dinámico def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(100_000)
  • 11. Eficiente Tiempo (s) Memoria (MB) C++ 5.08 1.1 Crystal 6.97 1.3 Ruby 226.86 8.0 Brainfuck https://github.com/kostya/benchmarks
  • 12. Eficiente Tiempo (s) Memoria (MB) Crystal 15.87 398.1 C++ 17.72 174.5 Python 396.54 724.0 Havlak https://github.com/kostya/benchmarks
  • 13. Eficiente Tiempo (s) Memoria (MB) Crystal 0.59 3.3 Go 1.43 2.3 Erlang 1.89 17.1 Ruby 41.73 30.0 Threadring https://github.com/kostya/crystal-benchmarks-game
  • 14. Eficiente Tiempo (relativo) Java 1.8.0_66 1.00 Crystal 1.58 Ruby MRI 2.3 47.59 Are we fast yet? http://stefan-marr.de/downloads/crystal.html
  • 16. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(100_000)
  • 17. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(“Ups”)
  • 18. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(“Ups”) # Error: no overload matches # `Int32#<` with type String
  • 19. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(“Ups”) # Error: no overload matches # `Int32#<` with type String
  • 20. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(“Ups”) # Error: no overload matches # `Int32#<` with type String
  • 21. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(100_000)
  • 22. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n : Int) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(100_000)
  • 23. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n : Int) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(“Ups”)
  • 24. Chequeo de tipos def prime?(n) (2..n).all? { |i| n % i != 0 } end def sexy_primes(n : Int) (9..n).map { |i| {i - 6, i} } .select { |i| i.all? { prime?(i) } } end puts sexy_primes(“Ups”) # Error: no overload matches # `sexy_primes` with type String
  • 25. Alto nivel numbers = [1, 2, 3, 4] puts numbers.map { |x| x + 10 } # => [11, 12, 13, 14] puts numbers[0] + numbers[-1] # => 5 phones = { “Ary” => “15512312312”, “Brian” => “1545645645”, “Juan” => “1578978978”, } puts phones[“Brian”] # => “1545645645”
  • 26. Bajo nivel ptr = Pointer(UInt8).malloc(20) ptr.value = 10_u8 puts ptr # => Pointer(UInt8)@0x109303e00 a = 1 ptr = pointerof(a) ptr.value = 2 puts a # => 2 buffer = uninitialized UInt8[1024]
  • 27. Bajo nivel lib LibC fun rand : LibC::Int end puts LibC.rand # => 16807
  • 28. ¿Por qué un lenguaje nuevo? ❖ Poca ceremonia ❖ Fácil de leer y escribir ❖ Apariencia de un lenguaje dinámico ❖ Eficiente ❖ Chequeo de tipos ❖ Alto y bajo nivel ❖ => Felicidad!
  • 30. Aplicaciones de consola ❖ tlcr: https://github.com/porras/tlcr ❖ crul: https://github.com/porras/crul ❖ vicr: https://github.com/veelenga/vicr ❖ shards: https://github.com/ysbaddaden/shards
  • 32. Juegos ❖ crsfml: https://github.com/BlaXpirit/crsfml ❖ crystal-gl: https://github.com/ggiraldez/crystal-gl
  • 33. Páginas web ❖ crystalshards: https://github.com/zamith/ crystalshards ❖ play.crystal-lang.org: https://github.com/jhass/carc.in
  • 34. Bots IRC ❖ DeBot: https://github.com/jhass/DeBot