Changes between Version 7 and Version 8 of UseDirective
- Timestamp:
- 03/29/14 09:19:11 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UseDirective
v7 v8 110 110 }}} 111 111 112 [[BR]] 113 Aliasing .Net namespaces to something more convenient 112 114 {{{ 113 115 #!cobra … … 125 127 }}} 126 128 127 129 Aliasing for shortening names 130 {{{ 131 #!cobra 132 namespace PC 133 134 # Define an alias for the nested namespace. 135 use Project = PC.MyCompany.Project 136 class A 137 138 def main is shared 139 # Use the alias 140 mc = Project.MyClass() 141 print mc 142 143 144 namespace MyCompany 145 namespace Project 146 class MyClass 147 pass 148 149 }}} 128 150 129 151 == Notes == 130 152 131 In most cases this syntax means you dont need to specify the commandline 132 -reference switch to provide the filename for a referenced namespace if the namespace dll follows 133 usual naming conventions. 153 In most cases this syntax means you dont need to specify the commandline -reference switch to provide the filename for a referenced namespace if the namespace dll follows usual naming conventions. 134 154 135 155 … … 163 183 source file rather than having to always remember (or script) a specific separate compiler commandline reference.. 164 184 165 e.g Assuming a namespace Augmented.!ExtendedConsole kept in a utility dll (!AugmentationLibrary.dll) say [[BR]]185 e.g Assuming a class Augmented.!ExtendedSys.!ExtConsole kept in a utility dll (!AugmentationLibrary.dll) say [[BR]] 166 186 167 187 rather than program !MyProg.cobra containing something like … … 169 189 #!cobra 170 190 ... 171 use Augmented.Extended Console191 use Augmented.ExtendedSys 172 192 ... 173 193 # use as 174 input = Ext endedConsole.input('Enter text:')194 input = ExtConsole.input('Enter text:') 175 195 176 196 }}} … … 184 204 #!cobra 185 205 ... 186 use Augmented.Extended Consolefrom AugmentionLibrary206 use Augmented.ExtendedSys from AugmentionLibrary 187 207 ... 188 208 }}} … … 197 217 198 218 199 Here (where the name is a l ttle cumbersome) for more convenience use both features...200 {{{ 201 #!cobra 202 ... 203 use AugCons = Augmented.Extended Console from AugmentationLibrary219 Here (where the name is a little cumbersome) for more convenience use both features... 220 {{{ 221 #!cobra 222 ... 223 use AugCons = Augmented.ExtendedSys.ExtConsole from AugmentationLibrary 204 224 ... 205 225 # use as