You can clone with
Cannot retrieve contributors at this time
<h2>Type System</h2>1. Primitive TypesIn HipHop, booleans, integers (8-, 16-, 32- and 64-bit) and doubles arerepresented as is with C++'s built-in primitive type support:- bool- char, short, int, long long- double2. String and Array classesStrings are represented as smart pointers of StringData objects, and arrays arerepresented as smart pointers of ArrayData objects: class String : public SmartPtr<StringData> class Array : public SmartPtr<ArrayData>We need smart pointers for both classes to implement pass-by-value semantics ofPHP without making real copies of internal data (StringData or ArrayData).Both classes have also utilized smart pointers to implement copy-on-write. Theywill only make real copies, when they are being modified AND reference count islarger than 1.3. Object classesIn HipHop, all user classes derive from ObjectData. PHP object variables willbecome smart pointers of different types of ObjectData objects.In PHP, objects are passed by reference automatically. Therefore, SmartPtr isonly helping ObjectData to do reference counting for proper deallocation whenreference count reaches zero.4. Variant classVariant type is union of all other types. When type inference fails to findout a symbol's type, it will automatically have Variant type.Variant class itself serves as both a "smart pointer wrapper" class and acountable class, so to make it a compact and reference-count-aware datastructure.<h2>Pass-by-reference for strings and arrays</h2>Variables passed by reference are always given Variant type.A variable passed by reference is strongly bound to its argument variable.Strong binding is implemented by replacing a variable's original value with areference cell holding that value. When another variable is strongly bound tothat variable, it acquires a reference to the cell. The reference cell isimplemented with a Variant. This is to easily pass operations from the outervariant to the inner variant. Because operations only change the inner variant,every outer variant that has a reference to it will see the change.