Changes between Version 2 and Version 3 of C
- Timestamp:
- 05/03/08 07:43:15 (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
C
v2 v3 6 6 * optional type declarations 7 7 * Block structured by indentation only (like Python) no squiggly braces (brackets) 8 * nil tracking - variables can be declared as nil assignable (or not)8 * nil tracking - variables can be declared as nil assignable (or not) 9 9 * Built in language support for 10 10 * unit test code … … 14 14 * Lists - [] - List of Dynamic 15 15 * Dictionaries - {:} Dictionary of <Dynamic, Dynamic> 16 * Sets - { }16 * Sets - {,} 17 17 * Line Oriented 18 * #to comment line (instead of //)18 * '''#''' to comment line (instead of //) 19 19 * No multiline comments 20 * _ to continue line 21 * Tab or Spaces to indent line ( Fixed 4 space indent), Cannot mix Tabs and spaces for an indent level 20 * '''_''' to continue line 21 * Tab or (4) Spaces to indent line (Fixed 4 space indent), Cannot mix Tabs and spaces for an indent level 22 * No statement terminator ( goodbye to ';') 23 * Numbers default to decimal type (rather than int)- can be overridden (to float/double) with a compiler 24 commandline option 22 25 23 26 * Methodnames and properties start with lowercase. (i.e lowerCamelCase) 24 27 * Access to methods/properties in used libraries are also done via (implicitly mapped ) lowerCamelCase methodnames 25 * Class names must be CamelCased28 * Class names must be (upper) [http://en.wikipedia.org/wiki/CamelCase CamelCased] or at least start with an upper case letter) 26 29 * instance variable optionally prefixed with _ (implicitly makes them private). If so prefixed can be accessed directly in methods 27 * methods (and properties) invoked with leading '''this.''' or more usuallyjust '''.'''.28 * constructor methodcalled init, has no return value30 * methods (and properties) on current object invoked with leading '''this.''' or more usually (shortcut) just '''.'''. 31 * constructor/initializer method is called init, has no return value 29 32 30 33 * String type accessed as '''string''' rather than '''String''' … … 33 36 * int8, int16, int/int32, int64 instead of SByte, Int16, Int32/int, Int64 34 37 * uint8, uint16, uint/uint32, uint64 instead of Byte, UInt16,... 38 * Type of numeric literals can be dictated using suffixes 35 39 36 * Variable specification - typing, access modifiers, argument attributes by keyword 'as' rather than C-like syntax37 * e.g. x as int32, instVar as string public 40 * Variable specification - typing, access modifiers, argument attributes specified by keyword '''as''' rather than C-like/Java-like syntax 41 * e.g. x as int32, instVar as string public (vs int32 x; public String instVar; ) 38 42 * typecasting by keyword '''to''' as in 'x to Type' rather than '(Type)x' 39 43 * cast to and away from nilable Type. 40 44 * '''as shared''' to declare a static type 41 45 46 42 47 * '''<>''' instead of '''!=''' for 'not equals' comparisons 48 * Condition negation uses keyword '''not''' ( as in {{{ not a >10}}} ) 49 * boolean conditions use keywords '''and''' and '''or''' ( as in {{{ if a>3 and b<10 or b>55 }}}) 43 50 * '''nil''' for no object (null) value 44 * Supports +=, -=, etc. It does not support ++ or -- unary operators ( use += 1 and -= 1 instead).51 * Supports +=, -=, etc. Does not support ++ or -- unary operators ( use += 1 and -= 1 instead). 45 52 46 53 * boolean conditions can be tested on any type. True is any of 54 * non false (bool Type) 47 55 * numeric not 0 56 * non zero char 48 57 * not nil 49 * non empty List or Dictionary58 * blank strings and empty collections are true (non nil) - must check .length for strings and .count for collections 50 59 51 60 * Strings delimited by single or double quotes, normal range of \c expansion ( e.g \n, \t) 52 61 * Substitute expressions (values) directly in strings by enclosing with []. 53 62 * such expressions can have optional String.format specification 54 * 'Raw' Strings (r"a raw string") no escape sequence expansion 63 * 'Raw' Strings (r"a raw string") no escape sequence expansion ( vs c# @"a raw string") 55 64 * '!NoSubstitution' strings ( ns" no substitution [done] here") 56 * !DocStrings on Programs, classes, Instan e variables, methods and properties65 * !DocStrings on Programs, classes, Instance variables, methods and properties 57 66 * Different syntax for characters c'x' 58 67 $ since '[] used for Lists array literals are specified using ''' @[]''' - comma separated values 59 68 * '''ref''' keyword for getting pointer to method ( reference) rather calling it ( for delegates) 60 69 * '''sig''' keyword or declaring a delegate type