Wiki

Changes between Version 7 and Version 8 of UseDirective

Show
Ignore:
Timestamp:
03/29/14 09:19:11 (4 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseDirective

    v7 v8  
    110110}}} 
    111111 
     112[[BR]] 
     113Aliasing .Net namespaces to something more convenient 
    112114{{{ 
    113115#!cobra 
     
    125127}}} 
    126128 
    127  
     129Aliasing for shortening names 
     130{{{ 
     131#!cobra 
     132namespace 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}}} 
    128150 
    129151== Notes == 
    130152 
    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. 
     153In 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. 
    134154 
    135155 
     
    163183source file rather than having to always remember (or script) a specific separate compiler commandline reference.. 
    164184 
    165 e.g Assuming a namespace Augmented.!ExtendedConsole kept in a utility dll (!AugmentationLibrary.dll) say [[BR]] 
     185e.g Assuming a class Augmented.!ExtendedSys.!ExtConsole kept in a utility dll (!AugmentationLibrary.dll) say [[BR]] 
    166186 
    167187rather than program !MyProg.cobra containing something like 
     
    169189#!cobra 
    170190... 
    171 use Augmented.ExtendedConsole 
     191use Augmented.ExtendedSys 
    172192... 
    173193    # use as  
    174     input = ExtendedConsole.input('Enter text:') 
     194    input = ExtConsole.input('Enter text:') 
    175195 
    176196}}} 
     
    184204#!cobra 
    185205... 
    186 use Augmented.ExtendedConsole from AugmentionLibrary 
     206use Augmented.ExtendedSys from AugmentionLibrary 
    187207... 
    188208}}} 
     
    197217 
    198218 
    199 Here (where the name is a lttle cumbersome) for more convenience use both features... 
    200 {{{ 
    201 #!cobra 
    202 ... 
    203 use AugCons = Augmented.ExtendedConsole from AugmentationLibrary 
     219Here (where the name is a little cumbersome) for more convenience use both features... 
     220{{{ 
     221#!cobra 
     222... 
     223use AugCons = Augmented.ExtendedSys.ExtConsole from AugmentationLibrary 
    204224... 
    205225    # use as