|
|
|
|
|
by brigandish
1919 days ago
|
|
> How comes and they don't allow you to optionally provide types in your function/class signatures Perhaps you mean something else, but this is from the book Programming Crystal: > Returning Values > A method returns the value of its last expression, so there’s no need to explicitly return that or declare its type. However, if you want to document or directly control that return type, you can explicitly specify the type, as in this example: > methods_and_procs/methods.cr def typed_method : Array(Int32)
(42..47).to_a.select { |n| n % 4 == 0 }
end
typed_method # => [44]
|
|
I would like Crystal compiler to take into account such definitions and speed up somehow. I know I am talking without experience, I just feel that coming from Ruby to Rust, declaring types on function definitions is not that much of a hassle.