1 Get rid of SourceElementsNode by integrating its functionality into
4 ==========================================================================
6 The hash value of a string could be calculated at creation time and be
7 stored in the UString instance for later use by the lookup functions.
9 ==========================================================================
11 Proposal for a new object model. Far from being complete.
14 +---------+ +-------------+
15 | type | ----------------> | toString() |
18 +---------+ | construct() |
24 | | Shared (optional) \|/ |
25 | data | +-------------+
26 +---------+ +---------+ | types |
27 /|\ | |<------| gc | Interpreter/Environment
30 +---------+ +-------------+
34 - offers class static data (nice replacement for pointers to member
35 function objects in the prototype object)
36 - no more need to pass around ExecState pointers for the C++ user
37 (substituted with the need for Object* in the type implementation)
38 - simple types are stored simple (no new'ed Imp objects)
40 Alternative A: pass around Object by pointer rather than value
41 rather than new'ing they should come out of a pool
43 Alternative B: instead of virtual functions like toBoolean(), Type could
44 have an array of function pointers which can be modified
45 on the fly and checked for != 0.
47 Limitations: Konqueror's requirement to allow access to other frame's
48 interpreter data but flagging errors on the caller's side
55 Type(Interpreter* i, Type *b) : ip(i), bs(b) { }
56 virtual UString name() const = 0;
57 Type* base() const { return bs; }
58 Interpreter* interpreter() const { return ip; }
60 virtual bool toBoolean(Object *o);
62 virtual Object construct(const List &args);
65 Boolean newBoolean(bool b) { return Boolean(interpreter(), b); }
82 Boolean newBoolean(bool b) { return Boolean(typ->interpreter(), b); }
85 bool to Boolean() const { return typ->toBoolean(this); }
87 // this object's "parent"
88 Interpreter* interpreter() const { return typ->ip; }
94 class Boolean : public Object {
96 // used by convenience function newBoolean()
97 Boolean(Interpreter *i, bool b) {
98 typ = i->booleanType();
101 Boolean(const Boolean &b) {
105 Boolean& operator=(const Boolean &b) {