-
|
It was only when I ran the compiled program and saw an exception thrown in my face that I realized I had used a non-existent method. There wasn't even a single warning at compile time. Why? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
ELENA is a dynamic language so it is expected behavior. You can send any message to any object. But still it is possible to get warning in that case. To do it you have to use strong-typed variables / fields / parameters. Here an example: The output is: So there is a warning. But if your declare a weak variable: There will be no warning In general, you have to use var only if you need a weak type. Otherwise you can use either explicit type of auto |
Beta Was this translation helpful? Give feedback.
ELENA is a dynamic language so it is expected behavior. You can send any message to any object. But still it is possible to get warning in that case. To do it you have to use strong-typed variables / fields / parameters.
Here an example:
The output is:
So there is a warning. But if your declare a weak…