Wiki

Changes between Initial Version and Version 1 of Use

Show
Ignore:
Timestamp:
09/29/09 11:53:57 (15 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Use

    v1 v1  
     1= Use = 
     2 
     3{{{ 
     4use <namespace> 
     5use <namespace> from <library-name> 
     6}}} 
     7 
     8Specify a namespace and its contents to make available to this module. 
     9 
     10When using the first form if the compiler cannot immediately locate  
     11the namespace [[BR]] 
     12(i.e if its not in the list of default loaded libraries)[[BR]] 
     13it will look for a (platform dependent) library-name of the same form as  
     14the namespace. 
     15 
     16For .Net thats the namespace with '.dll' appended  
     17 
     18{{{ 
     19use Foo.Bar  
     20# On .Net will look for namespace in Foo.Bar.dll if not already available 
     21}}} 
     22 
     23If the filename of the library differs from the namespace, you can specify  
     24it with the second form. [[BR]] 
     25<library-name> can be a simple identifier, qualified identifier (Foo.Bar)  
     26or a string literal. 
     27 
     28{{{ 
     29use Foo.Bar from SomeLib 
     30}}} 
     31You can put single or double quotes around the file name if its components  
     32are not legal identifiers.[[BR]] 
     33  
     34(for example, the filename has a space or punctuation mark in it). 
     35{{{ 
     36use Foo.Bar from "My Lib" 
     37}}} 
     38 
     39 
     40== Platform == 
     41On .Net <library-name> will refer to a .Net Assembly or dll. 
     42 
     43No ".dll" extension is expected (or allowed) in any of this syntax. 
     44 
     45In .Net the list of default loaded libraries is: 
     46  * System 
     47  * ?? 
     48  * !CobraCore (Cobra.Lang.dll) 
     49 
     50 
     51== Examples == 
     52{{{ 
     53use System.Windows.Forms  
     54use System.Drawing 
     55}}} 
     56 
     57== Notes == 
     58 
     59In most cases this syntax means you dont need to specify the commandline 
     60-reference switch  
     61 
     62With  !MyProg.cobra containing 
     63... 
     64    use Foo.Bar 
     65     
     66Instead of compilation by 
     67 
     68    cobra -reference:Foo.Bar !MyProg.cobra 
     69 
     70you can just say: 
     71 
     72    cobra !MyProg.cob