Serdar Doğruyol
@sdogruyol
Serdar Doğruyol
Ruby
def full_name(first_name, last_name)
first_name + last_name
end
NoMethodError: undefined method `+' for nil:NilClass
a.k.a
I WONT INTERPRET YOUR CODE IN PARALLEL
ko1's proposal for Ruby 3.0
include? anyone
#size
#length
Crystal
def full_name(first_name, last_name)
first_name + last_name
end
crystal build full_name.cr
./full_name
Error in line 5: instantiating 'full_name(Nil, String)' in line 2: undefined method '+' for Nil
--release
free optimizations!
a.k.a
Communicating Sequential Processes
require "socket"
channel = Channel(String).new
spawn do
server = TCPServer.new("0.0.0.0", 8080)
socket = server.accept
while line = socket.gets
channel.send(line)
end
end
spawn do
while line = gets
channel.send("Echo: #{line}")
end
end
loop do
puts channel.receive
end
includes?
contains?
class Human
def initialize(@first_name, @last_name, @skills)
end
end
Human.new "Serdar", "Dogruyol", ["ruby", "crystal"]
Int32 | String
@sdogruyol
https://slides.com/sdogruyol/crystal-a-better-ruby