Wiki

Changes between Version 18 and Version 19 of TypesOverview

Show
Ignore:
Timestamp:
06/04/13 08:52:03 (12 years ago)
Author:
hopscc
Comment:

gratuitous tweaking

Legend:

Unmodified
Added
Removed
Modified
  • TypesOverview

    v18 v19  
    77        * character literals are single quoted and preceeded by a c.  
    88           * For example {{{ var underscore as char = c'_' }}} 
    9      * int   (= int32) 
    10      * uint  (= uint32) 
    11      * float (= float64) 
     9     * int   (= '''int32''') 
     10     * uint  (= '''uint32''') 
     11     * float (= '''float64''') 
    1212     * decimal 
    13      * number  (defaults to decimal, Can change with compiler -number: option) 
     13     * number  (defaults to '''decimal''', Can change with compiler -number: option) 
    1414     * dynamic (see DynamicType) 
    1515   * Can be explicit wrt !Sizes/Sign 
     
    3939       * IEnumerable, IEnumerable<of T> (but use T* instead; see streams below) 
    4040       * IComparable, IComparable<of T> 
     41   * Mixins 
     42     * Reusable code implementation ( of interface or abstract class or just some capability) 
     43     * Not instantiated directly 
     44     * class declares use of a mixin explicitly and the implementation is melded into the class implicitly. 
    4145 
    4246 * Nilable Type 
    43    * Specifies that a variable can be either that type or nil (no-valued, Null) 
     47   * Specifies that a variable can be either that type or '''nil''' (no-valued, Null) 
    4448   * A nilable type is not directly assignable to a non nilable variable of the same Type  
    45        * requires explicit casting  to lose or gain nilability ( {{{ to !, to ? }}} 
    46    * Foo? - indicates nilable type Foo - can be type "Foo" or "nil" 
     49       * requires explicit casting  to lose or gain nilability ( {{{ to !, to ? }}} ) 
     50   * Foo? - indicates nilable type Foo - can be type "'''Foo'''" or "'''nil'''" 
    4751   * applicable to all types 
    48    * "dynamic" implies "dynamic?" meaning you can always pass "nil" where "dynamic" is expected 
     52   * "'''dynamic'''" implies "'''dynamic?'''" meaning you can always pass "'''nil'''" where "'''dynamic'''" is expected 
    4953 
    5054 * Streams 
     
    5559   * You can get the type of "x" with "x.getType" (library call) or "x.typeOf" (cobra language extension) 
    5660   * You can make instances with a type at run-time 
    57      * t = x.typeOf 
    58      * obj1 = t() 
    59      * obj2 = t(0, 0) 
     61    
     62{{{ 
     63#!cobra 
     64      t = x.typeOf 
     65      obj1 = t() 
     66      obj2 = t(0, 0) 
     67}}} 
     68 
    6069 
    6170 * Generics 
     
    6372   * These are identical to .NET generics as found in C# and VB. 
    6473   * Examples: List<of int>, List<of String>, Dictionary<of String, int> 
    65    * The general form is: Name<of T, U...> for a template where T are type placeholders. 
    66       * example: class ATag<of T> 
    67       * A generic type is instantiated by using the same name with a concrete type replacing the type placeholders 
    68         e.g ATag<of String> 
     74   * The general form is: Name<of T, U...> for a template where T and U are type placeholders. 
     75      * example: {{{ class ATag<of T> }}} 
     76      * A generic type is instantiated by using the same name with a concrete type replacing the type placeholders[[BR]] 
     77        e.g {{{ ATag<of String>() }}} 
    6978   * You can declare your own and or instantiate generic template types defined locally or in platform libraries. 
    7079   * You can overload by number of type arguments. In other words, Foo<of T> and Foo<of T, U> are two different types.