Changeset 2019
- Timestamp:
- 04/16/09 22:18:35 (3 years ago)
- Location:
- cobra/trunk
- Files:
-
- 9 modified
-
HowTo/200-MakeAClassHierarchy.cobra (modified) (1 diff)
-
HowTo/300-ImplementIEnumerable1.cobra (modified) (1 diff)
-
HowTo/301-ImplementIEnumerable2.cobra (modified) (1 diff)
-
HowTo/310-IterateThroughRecursiveDataWithYield.cobra (modified) (1 diff)
-
HowTo/400-DeepCopyObjects.cobra (modified) (1 diff)
-
Samples/forth.cobra (modified) (3 diffs)
-
Samples/Point.cobra (modified) (1 diff)
-
Samples/Shapes.cobra (modified) (1 diff)
-
Source/Cobra.Lang/Extensions.cobra (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/HowTo/200-MakeAClassHierarchy.cobra
r1983 r2019 101 101 body 102 102 sb = StringBuilder() 103 sb.append('[. getType.name]([_serialNum]') # example: 'Foo(1001)'103 sb.append('[.typeOf.name]([_serialNum]') # example: 'Foo(1001)' 104 104 .buildString(sb) # so subclasses can add their fields 105 105 sb.append(')') -
cobra/trunk/HowTo/300-ImplementIEnumerable1.cobra
r1983 r2019 45 45 46 46 def toString as String is override 47 return '[. getType.name]([_serialNum], [_name])'47 return '[.typeOf.name]([_serialNum], [_name])' 48 48 49 49 -
cobra/trunk/HowTo/301-ImplementIEnumerable2.cobra
r1983 r2019 35 35 36 36 def toString as String is override 37 return '[. getType.name]([_serialNum], [_name])'37 return '[.typeOf.name]([_serialNum], [_name])' 38 38 39 39 -
cobra/trunk/HowTo/310-IterateThroughRecursiveDataWithYield.cobra
r1983 r2019 32 32 33 33 def toString as String is override 34 return '[. getType.name](item=[.item])'34 return '[.typeOf.name](item=[.item])' 35 35 36 36 def dump -
cobra/trunk/HowTo/400-DeepCopyObjects.cobra
r1236 r2019 14 14 def copy(obj as Object) is shared 15 15 require 16 obj. getType.isSerializable16 obj.typeOf.isSerializable 17 17 body 18 18 try -
cobra/trunk/Samples/forth.cobra
r1982 r2019 146 146 methodName = word.toString['built-in:'.length:] 147 147 methodName = methodName[0].toString.toUpper + methodName[1:] # because at run-time, method names are capped for compatibility with C# and VB 148 method = . getType.getMethod(methodName)148 method = .typeOf.getMethod(methodName) 149 149 method.invoke(this, nil) 150 150 else … … 396 396 branch _which 397 397 on WordType.String 398 if _s == '' 399 return '(EMPTY-STRING)' 400 if _s.trim == '' 401 return '(BLANK-STRING)' 398 if _s == '', return '(EMPTY-STRING)' 399 if _s.trim == '', return '(BLANK-STRING)' 402 400 return _s to ! 403 401 on WordType.Int … … 407 405 def toTechString as String 408 406 branch _which 409 on WordType.String, return '[. getType.name](string, "[_s]")'410 on WordType.Int, return '[. getType.name](int, "[_i]")'407 on WordType.String, return '[.typeOf.name](string, "[_s]")' 408 on WordType.Int, return '[.typeOf.name](int, "[_i]")' 411 409 throw FallThroughException(_which) 412 410 -
cobra/trunk/Samples/Point.cobra
r1929 r2019 81 81 82 82 def toString as String is override 83 return '[. getType.name]([.x], [.y])'83 return '[.typeOf.name]([.x], [.y])' 84 84 85 85 def equals(other as Object?) as bool is override -
cobra/trunk/Samples/Shapes.cobra
r1985 r2019 37 37 their properties. 38 38 """ 39 print 'Draw [. getType.name] at ([_x], [_y]), ' stop39 print 'Draw [.typeOf.name] at ([_x], [_y]), ' stop 40 40 41 41 -
cobra/trunk/Source/Cobra.Lang/Extensions.cobra
r1957 r2019 2 2 3 3 extend System.Object 4 5 def typeOf as System.Type 6 """ Using.typeOf is portable between platforms in contrast to CLR .getType and JVM .getClass. """ 7 return .getType 4 8 5 9 def toTechString as String



