Wiki
Version 3 (modified by Chuck, 15 years ago)

--

Dynamic Type

  • See:  http://cobra-language.com/how-to/UseDynamicTyping/
  • "dynamic" is a keyword in Cobra.
  • Any kind of object, whether primitive, value, reference or nil, can be used where dynamic is expected.
  • "dynamic" is the default type of untyped object variables, method arguments and properties.
  • "dynamic" is *not* the default type for local variables which are statically typed as inferred by the right hand side of an expression ("i = 0" makes "i" an "int").
    • Of course, if the right hand expression is of type "dynamic" then so is the variable.
  • You can also cast an expression to dynamic with <expr> to dynamic.
  • Operations on dynamic expressions are late bound like in Smalltalk and Python.

See also: TypesOverview, LanguageTopics