Author:alexk

Date:2014-10-02T14:05:35.000000Z


git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@1393 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
alexk
2014-10-02 14:05:35 +00:00
parent d83b8f133c
commit 1ba046e4a2
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
[[Property:title|Draft]]
[[Property:weight|0]]
[[Property:uuid|c277e707-67a0-14a2-099e-5b861f2480ad]]

View File

@@ -176,7 +176,7 @@ Still, it's not too hard to understand the basics of initializing variables of a
===Self-initializing attributes===
A self-initializing attribute is guaranteed to have a value when accessed at run time. Declarations of self-initializing attributes are characterized by the use of the <code>attribute</code> keyword. The code that follows the <code>attribute</code> keyword is executed to initialize the attribute in the case that the attribute is accessed prior to being initialized in any other way.
A self-initializing attribute is guaranteed to have a value when accessed at run time. Declarations of self-initializing attributes are characterized by the use of the code that follows the <code>attribute</code> keyword. The code is executed to initialize the attribute in the case that the attribute is accessed prior to being initialized in any other way.
So, self-initializing attributes are ordinary attributes, with the restriction that they are of both ''attached'' types and ''reference'' types (i.e., not expanded types or constants). Self-initializing attributes still can be, and typically will be initialized in the traditional ways. The difference is that the code in the attribute part serves as a kind of safety net guaranteeing that a self-initializing attribute will never be void, even if it is accessed prior to being initialized by one of the traditional means.