Wiki

Changes between Version 17 and Version 18 of TypesOverview

Show
Ignore:
Timestamp:
04/11/12 05:30:19 (6 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypesOverview

    v17 v18  
    55     * bool 
    66     * char 
    7         * character literals are preceeded by a c.  For example var underscore as char = c'_' 
    8      * int  (= int32) 
     7        * character literals are single quoted and preceeded by a c.  
     8           * For example {{{ var underscore as char = c'_' }}} 
     9     * int   (= int32) 
    910     * uint  (= uint32) 
    10      * float  (= float64) 
     11     * float (= float64) 
    1112     * decimal 
    12      * number  (= decimal, change with -number: option) 
     13     * number  (defaults to decimal, Can change with compiler -number: option) 
    1314     * dynamic (see DynamicType) 
    14    * Explicit !Sizes/Sign 
     15   * Can be explicit wrt !Sizes/Sign 
    1516     * int8, int16, int32, int64 
    1617     * uint8, uint16, uint32, uint64 
    1718     * float32, float64 
    1819   * PrimitiveTypeMembers 
     20 
    1921 * Complex Types 
    2022   * Class 
     
    2931     * No inheritance (other than Object) 
    3032     * Value-based 
    31      * Popular structs 
     33     * Popular structs (CLR) 
    3234       * !DateTime, Color (System.Drawing) 
    3335   * Interface 
     
    3739       * IEnumerable, IEnumerable<of T> (but use T* instead; see streams below) 
    3840       * IComparable, IComparable<of T> 
     41 
    3942 * Nilable Type 
    40    * foo? - can be "foo" or "nil" 
    41    * applies to all types 
     43   * Specifies that a variable can be either that type or nil (no-valued, Null) 
     44   * 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" 
     47   * applicable to all types 
    4248   * "dynamic" implies "dynamic?" meaning you can always pass "nil" where "dynamic" is expected 
     49 
    4350 * Streams 
    4451   * foo* - walkable collection of zero or more objects of type foo 
    4552   * See StreamType 
     53 
    4654 * Working with types at run-time 
    4755   * You can get the type of "x" with "x.getType" (library call) or "x.typeOf" (cobra language extension) 
     
    5058     * obj1 = t() 
    5159     * obj2 = t(0, 0) 
     60 
    5261 * Generics 
    53    * Classes, interfaces and structs can all be generic--parameterized by type. 
     62   * Classes, interfaces and structs can all be generic -- parameterized by type. 
    5463   * These are identical to .NET generics as found in C# and VB. 
    5564   * Examples: List<of int>, List<of String>, Dictionary<of String, int> 
    56    * The general form is: Name<of T, U, ...> 
    57    * You can declare your own 
     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> 
     69   * You can declare your own and or instantiate generic template types defined locally or in platform libraries. 
    5870   * You can overload by number of type arguments. In other words, Foo<of T> and Foo<of T, U> are two different types. 
    5971   * Methods can be generic: def foo<of T>(a as T, b as T) 
     72 
    6073 * See also 
    6174   * [http://cobra-language.com/forums/viewtopic.php?f=4&t=291 Discussion on types]