mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 07:12:25 +01:00
Author:halw
Date:2009-09-08T19:07:20.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@298 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Viewing information about a feature]]
|
||||
[[Property:weight|3]]
|
||||
[[Property:uuid|0151eab9-ee25-210a-bed9-b2709e9fa5f0]]
|
||||
Once you [[Centering tools on a component|centered the editor]] on a feature, you have access to its text. The feature tab in the context tool can display more information. To have access to it, you have first to center the context tool on the wanted class and select the feature tab. You can then consult the different views of the text of the feature ([[Feature formatters: Basic text view|basic text]] or [[Feature formatters: Flat view|flat]]) and other information such as its [[Callers|callers]] or its [[Descendant versions|descendant]] versions. <br/>
|
||||
Once you [[Centering tools on a component|centered the editor]] on a feature, you have access to its text. The feature tab in the context tool can display more information. To have access to it, you have first to center the context tool on the wanted class and select the feature tab. You can then consult the different views of the text of the feature ([[Feature formatters: Basic text view|basic text]] or [[Feature formatters: Flat view|flat]]) and other information such as its [[Feature formatters: Callers|callers]] or its [[Descendant versions|descendant]] versions. <br/>
|
||||
The [[Metrics tool|metric tool]] provides another kind of data. It enables you to compute some [[How to analyze a project|measures]] on your feature.
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
[[Property:link_title|Using command line options]]
|
||||
[[Property:weight|1]]
|
||||
[[Property:uuid|a6b6a676-8660-ce2d-6f37-03de7f23a78e]]
|
||||
==Compiling and viewing==
|
||||
|
||||
You may start ec through a command of the following form:
|
||||
:'''ec''' ''option'' ... [''class_name''][''feature_name'']
|
||||
|
||||
@@ -181,6 +183,57 @@ You must now run "finish_freezing" in:
|
||||
|
||||
with | replaced by \ if your platform is Windows, / if it is Unix. To execute the C compilation and linking part of the finalization, change directory to ''your_project_path''|EIFGENs|''target_name''|F_code as indicated and execute '''finish_freezing'''.
|
||||
|
||||
===Usage of finish_freezing===
|
||||
|
||||
<code lang="text">
|
||||
finish_freezing [-location <directory>] [-generate_only] [-nproc <n>] [-low]
|
||||
[-x86] [-silent [-silent...]] [-library [-library...]] [-version] [-nologo]
|
||||
</code>
|
||||
|
||||
OPTIONS:
|
||||
:Options should be prefixed with: '-' or '/'
|
||||
|
||||
{| border="1"
|
||||
|-
|
||||
| '''OPTION'''
|
||||
| '''ARGUMENTS'''
|
||||
|-
|
||||
|-
|
||||
| -location
|
||||
| Alternative location to compile C code in. (Optional)
|
||||
<directory>: Location to compile C code in
|
||||
|-
|
||||
| -generate_only
|
||||
| Informs tool to only generate a Makefile. (Optional)
|
||||
|-
|
||||
| -nproc
|
||||
| Maximum number of processors to use (Optional)
|
||||
<n>: Number of processors
|
||||
|-
|
||||
| -low
|
||||
| Executes finish freezing in low-execution priority mode. (Optional)
|
||||
|-
|
||||
| -x86
|
||||
| Generate 32bit lib DLLs for .NET projects. (Optional)
|
||||
|-
|
||||
| -silent
|
||||
| Suppresses confirmation dialog (Optional)
|
||||
|-
|
||||
| -library
|
||||
| Compiles the C code of an Eiffel library (Optional)
|
||||
|-
|
||||
| -?
|
||||
| Display usage information. (Optional)
|
||||
|-
|
||||
| -version
|
||||
| Displays version information. (Optional)
|
||||
|-
|
||||
| -nologo
|
||||
| Supresses copyright information. (Optional)
|
||||
|}
|
||||
|
||||
|
||||
|
||||
{{seealso|<br/>
|
||||
[[Batch compilation|Batch compilation]] }}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ It is available through the '''Class''' tab of the [[EiffelStudio window overvie
|
||||
|
||||
{{seealso|<br/>
|
||||
[[Suppliers|Suppliers]] <br/>
|
||||
[[Callers|Feature callers]] }}
|
||||
[[Feature formatters: Callers|Feature callers]] }}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
[[Property:title|Ancestor versions]]
|
||||
[[Property:link_title|Feature formatters: Ancestor versions]]
|
||||
[[Property:title|Feature formatters: Ancestor versions]]
|
||||
[[Property:weight|10]]
|
||||
[[Property:uuid|ca7f840d-30fb-c1cb-8f2f-6b45aa244f95]]
|
||||
The ancestor view [[Image:feature-ancestors-icon]] displays all the features which the current feature is redefining.
|
||||
The '''ancestor versions''' view [[Image:feature-ancestors-icon]] displays all the features which the current feature is redefining.
|
||||
|
||||
|
||||
{{seealso|<br/>
|
||||
[[Descendant versions|Descendant versions]] }}
|
||||
[[Feature formatters: Descendant versions|Descendant versions]] }}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Feature formatters: Assignees]]
|
||||
[[Property:weight|7]]
|
||||
[[Property:uuid|98b4c8f2-272f-c2b6-1f8f-bd86aadbddc2]]
|
||||
The '''assignees''' [[Image:feature-assignees-icon]] view lists all features which appear in the current feature as targets of assignments.
|
||||
The '''assignees''' view [[Image:feature-assignees-icon]] lists all features which appear in the current feature as targets of assignments.
|
||||
|
||||
As with [[Feature formatters: Assigners|assigners]], this includes true assignments to class features only, that is, it does not include "targets" of the assignment-like syntax of '''assignment commands'''.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Feature formatters: Assigners]]
|
||||
[[Property:weight|4]]
|
||||
[[Property:uuid|6fdc5d59-d63b-39f7-68f8-13777077cbd2]]
|
||||
The assigners view [[Image:feature-assigners-icon]] displays the features which assign to the current feature.
|
||||
The '''assigners''' view [[Image:feature-assigners-icon]] displays the features which assign to the current feature.
|
||||
|
||||
This means that unless the current feature is an attribute, assignment is not defined and this view will be empty.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Feature formatters: Basic text view]]
|
||||
[[Property:weight|1]]
|
||||
[[Property:uuid|ad171d9e-9d67-7fb9-10e5-db237b04e40e]]
|
||||
Basic text view [[Image:view-editor-feature-icon]] displays the text of the current feature as it is written in the enclosing class. <br/>
|
||||
The '''basic text''' view [[Image:view-editor-feature-icon]] displays the text of the current feature as it is written in the enclosing class. <br/>
|
||||
It does not work with [[Breakpoints|breakpoints]]; in order to do this the [[Feature formatters: Flat view|flat view]] has to be used.
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Feature formatters: Callees]]
|
||||
[[Property:weight|6]]
|
||||
[[Property:uuid|0e81a9a8-9bce-91b3-3dce-b0c09186837e]]
|
||||
The callees view will list the names of all features used by the current feature. This includes those features called directly, and as appropriate, those features which are targets of assignments in the current feature (the feature's assignees [[Image:feature-assignees-icon]], those features which are the targets of creation instructions in the current feature (the feature's creations [[Image:feature-creations-icon]], and those features which are used by the current feature as arguments in calls to other features.
|
||||
The '''callees''' view [[Image:feature-callees-icon]] will list the names of all features used by the current feature. This includes those features called directly, and as appropriate, those features which are targets of assignments in the current feature (the feature's assignees [[Image:feature-assignees-icon]], those features which are the targets of creation instructions in the current feature (the feature's creations [[Image:feature-creations-icon]], and those features which are used by the current feature as arguments in calls to other features.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
[[Property:title|Callers]]
|
||||
[[Property:link_title|Feature formatters: Callers]]
|
||||
[[Property:title|Feature formatters: Callers]]
|
||||
[[Property:weight|3]]
|
||||
[[Property:uuid|63b7a88c-86ff-7aef-bf31-05d0ed850e4e]]
|
||||
The callers view [[Image:feature-callers-icon]] displays all the features which use the current feature in any way.
|
||||
The '''callers''' view [[Image:feature-callers-icon]] displays all the features which use the current feature in any way.
|
||||
|
||||
|
||||
So the callers view includes features which actually call the current feature.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Feature formatters: Creations]]
|
||||
[[Property:weight|8]]
|
||||
[[Property:uuid|97a25a8d-42c8-f968-fa66-1d270e82a8c8]]
|
||||
The feature '''creations''' [[Image:feature-creations-icon]] view displays the names of any features which appear in the current feature as targets of creation instructions.
|
||||
The feature '''creations''' view [[Image:feature-creations-icon]] displays the names of any features which appear in the current feature as targets of creation instructions.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Feature formatters: Creators]]
|
||||
[[Property:weight|5]]
|
||||
[[Property:uuid|ece55aae-5922-b6ec-7b50-b4c97cba7cc0]]
|
||||
The creators [[Image:feature-creators-icon]] view shows all features in which the current feature appears as the target of a creation instruction. The creators view will be empty for any feature which is not an attribute.
|
||||
The '''creators''' view [[Image:feature-creators-icon]] shows all features in which the current feature appears as the target of a creation instruction. The creators view will be empty for any feature which is not an attribute.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
[[Property:title|Descendant versions]]
|
||||
[[Property:link_title|Feature formatters: Descendant versions]]
|
||||
[[Property:title|Feature formatters: Descendant versions]]
|
||||
[[Property:weight|11]]
|
||||
[[Property:uuid|c232a74a-7264-c8e1-4613-a65d75302602]]
|
||||
The descendant view [[Image:feature-descendents-icon]] displays all the features that redefine the current feature.
|
||||
The '''descendant versions''' view [[Image:feature-descendents-icon]] displays all the features that redefine the current feature.
|
||||
|
||||
|
||||
{{seealso|<br/>
|
||||
[[Ancestor versions|Ancestor versions]] }}
|
||||
[[Feature formatters: Ancestor versions|Ancestor versions]] }}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Feature formatters: Flat view]]
|
||||
[[Property:weight|2]]
|
||||
[[Property:uuid|b325d97c-772d-8207-a901-a401c6a61376]]
|
||||
The flat view [[Image:view-clickable-feature-icon]] displays the feature body as it is seen at run-time (according to ancestor versions, if any). This is why it is possible to add or remove [[Breakpoints|breakpoints]] in this view.
|
||||
The '''flat''' view [[Image:view-clickable-feature-icon]] displays the feature body as it is seen at run-time (according to ancestor versions, if any). This is why it is possible to add or remove [[Breakpoints|breakpoints]] in this view.
|
||||
|
||||
|
||||
{{seealso|<br/>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
[[Property:title|Homonyms]]
|
||||
[[Property:link_title|Feature formatters: Homonyms]]
|
||||
[[Property:title|Feature formatters: Homonyms]]
|
||||
[[Property:weight|12]]
|
||||
[[Property:uuid|933b22f0-c181-fd65-9b52-be20270b00af]]
|
||||
The homonyms view [[Image:feature-homonyms-icon]] displays all the features in the system which have the same name as the current feature.
|
||||
The '''homonyms''' view [[Image:feature-homonyms-icon]] displays all the features in the system which have the same name as the current feature.
|
||||
|
||||
|
||||
{{warning|: This operation may take a long time if the system has a lot of classes. }}
|
||||
|
||||
|
||||
{{seealso|<br/>
|
||||
[[Implementers|Implementers]] }}
|
||||
[[Feature formatters: Implementers|Implementers]] }}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
[[Property:title|Implementers]]
|
||||
[[Property:link_title|Feature formatters: Implementers]]
|
||||
[[Property:title|Feature formatters: Implementers]]
|
||||
[[Property:weight|9]]
|
||||
[[Property:uuid|4032bef0-39e5-5fa6-0ffe-156392c0234e]]
|
||||
The implementers view [[Image:feature-implementers-icon]] displays all the different versions of the current feature by exploring the [[Ancestor versions|ancestor versions]] and the [[Descendant versions|descendant versions]], and selecting among those the ones which are not inherited.
|
||||
The '''implementers''' view [[Image:feature-implementers-icon]] displays all the different versions of the current feature by exploring the [[Feature formatters: Ancestor versions|ancestor versions]] and the [[Feature formatters: Descendant versions|descendant versions]], and selecting among those the ones which are not inherited.
|
||||
|
||||
|
||||
{{seealso|<br/>
|
||||
[[Ancestor versions|Ancestor versions]] <br/>
|
||||
[[Descendant versions|Descendant versions]] }}
|
||||
[[Feature formatters: Ancestor versions|Ancestor versions]] <br/>
|
||||
[[Feature formatters: Descendant versions|Descendant versions]] }}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,16 +7,16 @@ Feature views are all available through the '''Feature''' tab of the [[EiffelStu
|
||||
These views (and their associated icon) are:
|
||||
* [[Image:view-editor-feature-icon]] [[Feature formatters: Basic text view|Basic text view]]
|
||||
* [[Image:view-clickable-feature-icon]] [[Feature formatters: Flat view|Flat view]]
|
||||
* [[Image:feature-callers-icon]] [[Callers|Callers]]
|
||||
* [[Image:feature-callers-icon]] [[Feature formatters: Callers|Callers]]
|
||||
* [[Image:feature-assigners-icon]] [[Feature formatters: Assigners|Assigners]]
|
||||
* [[Image:feature-creators-icon]] [[Feature formatters: Creators|Creators]]
|
||||
* [[Image:feature-callees-icon]] [[Feature formatters: Callees|Callees]]
|
||||
* [[Image:feature-assignees-icon]] [[Feature formatters: Assignees|Assignees]]
|
||||
* [[Image:feature-creations-icon]] Creations
|
||||
* [[Image:feature-implementers-icon]] [[Implementers|Implementers]]
|
||||
* [[Image:feature-ancestors-icon]] [[Ancestor versions|Ancestor versions]]
|
||||
* [[Image:feature-descendents-icon]] [[Descendant versions|Descendant versions]]
|
||||
* [[Image:feature-homonyms-icon]] [[Homonyms|Homonyms]]
|
||||
* [[Image:feature-creations-icon]] [[Feature formatters: Creations|Creations]]
|
||||
* [[Image:feature-implementers-icon]] [[Feature formatters: Implementers|Implementers]]
|
||||
* [[Image:feature-ancestors-icon]] [[Feature formatters: Ancestor versions|Ancestor versions]]
|
||||
* [[Image:feature-descendents-icon]] [[Feature formatters: Descendant versions|Descendant versions]]
|
||||
* [[Image:feature-homonyms-icon]] [[Feature formatters: Homonyms|Homonyms]]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -599,20 +599,52 @@ The only exception to the last rule is termination of the original root procedur
|
||||
|
||||
==Abstraction==
|
||||
|
||||
===Restriction of assignment targets===
|
||||
|
||||
The description of assignments stated that in <code>x := y</code> the target <code>x</code> must be an entity. More precisely it must be a '''writable''' entity. This notion excludes formal routine arguments: as noted, a routine <code>r (arg: SOME_TYPE)</code> may not assign to <code>arg</code> (reattaching it to a different object), although it can change the attached objects through calls of the form <code>arg.procedure (...)</code> .
|
||||
|
||||
Restricting assignment targets to entities precludes assignments of the form <code>obj.some_attribute := some_value</code> , since the left-hand side <code>obj.some_attribute</code> is an expression (a feature call), not an entity: you may no more assign to <code>obj.some_attribute</code> than to, say, <code>b + a</code> -- another expression that is also, formally, a feature call.
|
||||
|
||||
To obtain the intended effect of such an assignment you may use a procedure call of the form <code>obj.set_attribute (some_value)</code> , where the base class of <code>obj</code>'s type has defined the procedure
|
||||
Restricting the targets of assignments to entities precludes assignments of the form
|
||||
<code>
|
||||
set_attribute (v: VALUE_TYPE)
|
||||
-- Set value of attribute to v.
|
||||
obj.some_attribute := some_value
|
||||
-- This syntax is disallowed (except in the presence of an `assigner command', see below)
|
||||
</code>
|
||||
This is because the left-hand side <code>obj.some_attribute</code> is an expression (a feature call), not an entity: you may no more assign to <code>obj.some_attribute</code> than to, say, <code>b + a</code> -- another expression that is also, formally, a feature call.
|
||||
|
||||
To obtain the intended effect of such an assignment you may use a procedure call, where the base class of <code>obj</code>'s type has defined the procedure
|
||||
<code>
|
||||
set_some_attribute (v: VALUE_TYPE)
|
||||
-- Set value of some_attribute to `v'.
|
||||
do
|
||||
attribute := v
|
||||
some_attribute := v
|
||||
end
|
||||
</code>
|
||||
|
||||
This rule is essential to enforcing the method. Permitting direct assignments to an object's fields -- as in C++ and Java -- would violate all the tenets of information hiding by letting clients circumvent the interface carefully crafted by the author of a supplier class. It is the responsibility of each class author to define the exact privileges that the class gives to each of its clients, in particular field modification rights. Building a class is like building a machine: you design the internals, to give yourself the appropriate mechanisms; and you design the control panel, letting users (clients) access the desired subset of these mechanisms, safely and conveniently.
|
||||
So instead of the disallowed assignment shown above, you would code:
|
||||
<code>
|
||||
obj.set_some_attribute (some_value)
|
||||
</code>
|
||||
|
||||
This rule is essential to enforcing the method. Permitting direct assignments to an object's fields -- as in C++ and Java -- would violate all the tenets of information hiding by letting clients circumvent the interface carefully crafted by the author of a supplier class.
|
||||
|
||||
===Assigner commands===
|
||||
|
||||
However, many developers have become accustomed to reading and writing code in other languages which do allow assignments of the form:
|
||||
<code>
|
||||
obj.some_attribute := some_value
|
||||
</code>
|
||||
For this reason, it is possible in Eiffel to allow such a syntax without actually enabling an end-run around the constraints of the class. It is done by using a facility called an '''assigner command'''. In the example shown in the previous section, we might expect <code>some_attribute</code> to be declared something like this:
|
||||
<code>
|
||||
some_attribute: SOME_TYPE
|
||||
</code>
|
||||
If this were the case the assignment above would cause a syntax error at compile time. But if the declaration included the specification of an assigner command, as shown below, then the assignment syntax would be valid.
|
||||
<code>
|
||||
some_attribute: SOME_TYPE assign set_some_attribute
|
||||
</code>
|
||||
The assigner command then is the procedure <code>set_some_attribute</code> coded as shown in the previous section. In the presence of the assigner command, the previously invalid assignment syntax is now valid. But it is translated by the compiler as a call to <code>set_some_attribute</code>, using the source of the assignment as an argument.
|
||||
|
||||
===Controlling modification of class fields===
|
||||
|
||||
It is the responsibility of each class author to define the exact privileges that the class gives to each of its clients, in particular field modification rights. Building a class is like building a machine: you design the internals, to give yourself the appropriate mechanisms; and you design the control panel, letting users (clients) access the desired subset of these mechanisms, safely and conveniently.
|
||||
|
||||
The levels of privilege available to the class author include, for any field:
|
||||
* Hide the field completely from clients, by exporting the corresponding attribute to <code>NONE</code>.
|
||||
|
||||
@@ -24,7 +24,7 @@ To implement a client of the <eiffel>StringManipulator</eiffel> component open a
|
||||
{{note|If a COM component should be added to an existing client, the generated ecf file can be added as a library. }}
|
||||
|
||||
==Contracts==
|
||||
Contracts can be broken directly on the proxy in which case you will get a standard contract violation in the client. If contracts are broken on the server then the exception will be forwarded by the EiffelCOM runtime to the client. The feature replace_substring_user_precondition in <eiffel>MY_STRING_MANIPULATOR</eiffel> includes has some assertions.: Comment them out. Now the contract of the [[ref:libraries/base/reference/string_8_chart|<code>replace_substring </code>]] feature is wrong and erroneous calls can be made. Quick melt the changes and run the client. Enter some invalid numbers in the fields used to call this feature. After you click '''Replace''' you will see an error message box warning you that a precondition was violated on the server side. This demonstrates contracts `over the wire'. The precondition was violated in the server; this exception was caught by the EiffelCOM runtime and sent back to the client.
|
||||
Contracts can be broken directly on the proxy in which case you will get a standard contract violation in the client. If contracts are broken on the server then the exception will be forwarded by the EiffelCOM runtime to the client. The feature replace_substring_user_precondition in <eiffel>MY_STRING_MANIPULATOR</eiffel> includes has some assertions. Comment them out. Now the contract of the [[ref:libraries/base/reference/string_8_chart|<code>replace_substring </code>]] feature is wrong and erroneous calls can be made. Quick melt the changes and run the client. Enter some invalid numbers in the fields used to call this feature. After you click '''Replace''' you will see an error message box warning you that a precondition was violated on the server side. This demonstrates contracts `over the wire'. The precondition was violated in the server; this exception was caught by the EiffelCOM runtime and sent back to the client.
|
||||
{{seealso|<br/>
|
||||
[[Creating a new COM component|Creating a new COM component]] <br/>
|
||||
[[Creating a new component from an Eiffel project|Creating a new component from an Eiffel Project]] }}
|
||||
|
||||
Reference in New Issue
Block a user