You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In section "Instance variables type inference" of Docs we can read the following:
Did you notice that in all of the previous examples we never said the types of a Person's @name and @Age? This is because the compiler inferred them for us.
Then we see an example of what is said above:
`class Person
getter name
So it seems like Docs say that compiler must infer the type of incoming value for an instance variable by itself, but in practice we see that compiler can't do this and we should exactly specify the type. Who's wronge? The compiler or the Docs?
The text was updated successfully, but these errors were encountered:
@smellyshovel read the book to understand Crystal and its philosophy, and read the API as reference material. You'll probably find outdated bits here and there, but they're the main sources of information about Crystal.
When you find something outdated, you can send PRs to this repo for API docs, and to https://github.com/crystal-lang/crystal-book for the book. Or, if you're not sure how to fix a problem, just open issues like this one.
In section "Instance variables type inference" of Docs we can read the following:
But, what's an irony, exactly about this code compiler says that it's invalid, saying
So it seems like Docs say that compiler must infer the type of incoming value for an instance variable by itself, but in practice we see that compiler can't do this and we should exactly specify the type. Who's wronge? The compiler or the Docs?
The text was updated successfully, but these errors were encountered: