> but if you want to learn the semantics why not just go to their docs?
https://crystal-lang.org/docs/syntax_and_semantics/index.htm...Yep, fair enough. I'm somewhat worried about how abstract classes work: https://crystal-lang.org/docs/syntax_and_semantics/virtual_a...
Apparently, Crystal can infer the methods of an abstract class from the methods of its subclasses. In the Animal/Dog/Cat example, what happens if, in a separate module, if define a Snake class that doesn't have a `talk` method? There are several possibilities, sadly all pretty bad:
(0) Does the type checker retroactively decide that not all Animals can talk?
(1) Does the type checker decide that Animal subclasses can't be defined in a separate module?
(2) Does the type checker decide that, if an Animal subclass is defined in a separate module, it must have all the common methods to all Animal subclasses defined in the same module as Animal?
(3) Is type checking not modular?
> That's why the recommended mechanism to communicate data is using channels and sending messages between them.
I'm asking about the errors that the language prevents, not the community's conventions.
Yep, fair enough. I'm somewhat worried about how abstract classes work: https://crystal-lang.org/docs/syntax_and_semantics/virtual_a...
Apparently, Crystal can infer the methods of an abstract class from the methods of its subclasses. In the Animal/Dog/Cat example, what happens if, in a separate module, if define a Snake class that doesn't have a `talk` method? There are several possibilities, sadly all pretty bad:
(0) Does the type checker retroactively decide that not all Animals can talk?
(1) Does the type checker decide that Animal subclasses can't be defined in a separate module?
(2) Does the type checker decide that, if an Animal subclass is defined in a separate module, it must have all the common methods to all Animal subclasses defined in the same module as Animal?
(3) Is type checking not modular?
> That's why the recommended mechanism to communicate data is using channels and sending messages between them.
I'm asking about the errors that the language prevents, not the community's conventions.