Skip to content

Instantly share code, notes, and snippets.

@Papierkorb
Created December 16, 2017 17:28
Show Gist options
  • Save Papierkorb/946cee0118602e3146aa2438aede96f0 to your computer and use it in GitHub Desktop.
Save Papierkorb/946cee0118602e3146aa2438aede96f0 to your computer and use it in GitHub Desktop.
Demo of type inference of local variables through concurrently ran fibers
waiter = Channel(Nil).new
var = "Hello"
spawn do
waiter.receive
var = 5
end
puts "var is a #{typeof(var)}"
puts "var right now is a #{var.class}"
waiter.send(nil)
puts "var right now is a #{var.class}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment