Difference between revisions of "Internal and Expanded"

Line 4: Line 4:
 
To make the discussion consistent, let's suppose we have the following set of classes:
 
To make the discussion consistent, let's suppose we have the following set of classes:
  
<code>
+
<e>
 
class A
 
class A
 
feature
 
feature
Line 21: Line 21:
 
sc: STRING
 
sc: STRING
 
end
 
end
</code>
+
</e>
  
 
==Nothing special==
 
==Nothing special==
Line 30: Line 30:
  
 
==Extra fields==
 
==Extra fields==
The attributes of the expanded are also visible as extra fields of the object. In other words
+
The attributes of the expanded are also visible as extra fields of the object. In other words, we would see for class A either one of the following:
 +
#All components:
 +
#* b
 +
#* b.c
 +
#* b.c.sc
 +
#* b.sb
 +
#* sa
 +
#All first level components and then only necessary components:
 +
#* b
 +
#* b.c.sc
 +
#* b.sb
 +
#* sa
 +
#Necessary components:
 +
#* b.c.sc
 +
#* b.sb
 +
#* sa
 +
 
 +
Clearly the thrid option is what is enough, however it would break existing code relying on the presence of ''b''. So we will offer the second variant with a flag to say if the field was an extra field or not.

Revision as of 10:39, 23 March 2010

We are discussing here how to export the description of expanded fields in a normal object to enable a fast and efficient introspection of objects at runtime. We will describe the various possibilities the last one being the implementation we have chosen in EiffelStudio.

To make the discussion consistent, let's suppose we have the following set of classes:

class A
feature
	b: B
	sa: STRING
end
 
expanded class B
feature
	c: C
	sb: STRING
end
 
expanded class C
feature
	sc: STRING
end

Nothing special

As of version 6.5 and before of EiffelStudio, one can use `field' and `set_field' to get and set the expanded attributes

pros: simple cons: very inefficient

Extra fields

The attributes of the expanded are also visible as extra fields of the object. In other words, we would see for class A either one of the following:

  1. All components:
    • b
    • b.c
    • b.c.sc
    • b.sb
    • sa
  2. All first level components and then only necessary components:
    • b
    • b.c.sc
    • b.sb
    • sa
  3. Necessary components:
    • b.c.sc
    • b.sb
    • sa

Clearly the thrid option is what is enough, however it would break existing code relying on the presence of b. So we will offer the second variant with a flag to say if the field was an extra field or not.