Show
Ignore:
Timestamp:
07/30/08 22:41:32 (5 months ago)
Author:
Chuck.Esterbrook
Message:

Added some notes about coding conventions.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Developer/ImplementationNotes.text

    r1552 r1563  
    235235TODO 
    236236 
     237During this phase, avoid storing "sharp" values such `someType.sharpRef`. While C# is Cobra's current backend, there will likely be other backends in the future including CIL, JVM, Objective-C, etc. Instead store a reference to the type or other object and then access its "sharp" properties during C# code gen (typically in a .writeSharpDef method implementation). 
     238 
     239 
     240.h2 @ Code generation phase 
     241 
     242TODO 
     243 
     244The code generation is currently C#. 
     245 
     246When a statement needs to create a private local variable to help with its implementation, there are some conventions to follow which prevent problems. First, start them with an underscore (_) which will eliminate any possibility of collision with explicit locals (Cobra does not allow locals to start with an undescore). Also, use "_lh_" for local helper which reduces chance collisions with object variables. Also, add the serial number of the current node to further prevent collisions including with other local helper variables. For example: 
     247 
     248.code 
     249        def writeSharpDef(sw as SharpWriter) 
     250                # ... 
     251                localName = '_lh_event_[.serialNum]' 
     252 
    237253 
    238254.h2 @ Run phase