Phoenix Primitives

To manipulate code, Phoenix provides a full-range of features. Lets discuss some primitives features in Phoenix to support your codes. This is the basic knowledge you have to learn in your Phoenix Journey;

STRING and NAME
Phx:String and Phx:Name are the two classes for storing and manipulating strings. String is richer than Name who has shared memory in nature. Name saves memory, and it allows fast comparison for equality – by comparing the two pointers, rather than performing a character-by-character match. Phx:String for unmanaged code is managed by Phx:Lifetime. In managed code, PhxString uses .NET's System::String class, so those characters are stored in the .NET GC heap. Phx:String is immutable – after construction, the string cannot be changed. So any method whose name suggests it would change a string (eg: String::Remove), in fact constructs a new result string, leaving the original intact in memory. All Phoenix strings are stored as wide (16-bit) characters. Becarefull with this.

CONTROLS
Phoenix uses user-specifiable controls to manage program behavior, generally specified as command-line arguments. Controls can also be set programmatically from strings or explicitly via methods. Each compiler or tool has its convention for specifying command-line arguments, usually using a dash before the control (e.g., -dumpctrls).
Phoenix uses several built-in controls, and each user-written tool or phase may register their own. Hence, there are a large number of controls. To obtain the current list with terse descriptions, use the dumpctrls control. This will send the list to standard out (STDOUT), as we have done here:

cl  –B2   -d2dumpctrls  hello.c

Phoenix components, generally have an associated control, called a component control, that acts as its proxy during control processing. Often this control is associated with the phase wrapping the component. The current set can be found in the dumpctrls output, in the Component controls category. This proxy control encapsulates various behaviors of the component, such as enabling/disabling the component, tracing, logging, dumping, and timing. A small but extensible set of controls, component modifier controls, manipulate the behaviors of components, rather than each component control exposing access to each of its behaviors.

COLLECTIONS
To make handling more convenient, you can group objects of any type into a single data structure, such as a list, hash, or a vector. Phoenix defines these common data structures in the Collections namespace. The Collections feature uses compile-time polymorphism to improve compiler performance and eliminates static cast operations that can throw runtime type exceptions or crash the system.
The following list shows standard container features that the Collections namespace offers.

- Basic manipulation New() and Delete() methods
- Insert() and Remove()
- Iterate through Iterator() method
- Count through collection using Count() method
- Push/Pop

Share this post: | | | |
Published Tuesday, September 05, 2006 9:53 AM by Risman Adnan Mattotorang

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: