No, that's different from type inference. Type inference preserves strict
typing. It is most useful for anonymous classes or templates. That is the
cases when it is preferred to let compiler to decide on the type of a
variable.

Think of retrieving values from the database and wanting to have strictly
typed objects to be built based upon the query results. It is to boring to
generate those classes by hand + it adds extra code to the application. It
is better to leave it to compiler or the runtime to generate those things
instead. Another case is when you are using a template, which the compiler
will interpret differently every time, depending on how it is used.

Using dynamic on the other hand is error prone and slow. Switching strict
mode off is never a good idea. In fact, I think it would be only better if
that option never existed.

Reply via email to