From c14d26b0fbaf34f9aea681651c52b90621fe412b Mon Sep 17 00:00:00 2001 From: halw Date: Wed, 28 Oct 2009 02:00:10 +0000 Subject: [PATCH] Author:halw Date:2009-10-28T02:00:10.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@340 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../converting-existing-software-void-safety/index.wiki | 8 ++------ .../creating-new-void-safe-project.wiki | 8 ++++---- .../void-safety-background-definition-and-tools.wiki | 6 +++++- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/documentation/current/method/void-safe-programming-eiffel/converting-existing-software-void-safety/index.wiki b/documentation/current/method/void-safe-programming-eiffel/converting-existing-software-void-safety/index.wiki index ee3ef706..a5245eef 100644 --- a/documentation/current/method/void-safe-programming-eiffel/converting-existing-software-void-safety/index.wiki +++ b/documentation/current/method/void-safe-programming-eiffel/converting-existing-software-void-safety/index.wiki @@ -49,7 +49,7 @@ First make sure your project will compile correctly under the configuration of E Then set the project setting '''Full Class Checking''' to '''True'''. Do a ''clean'' compile of your system. To do this shut down EiffelStudio, and restart it. When the project selection dialog appears, select your project, then next to '''Action:''' select '''Compile''' in the drop-down, and check '''Clean'''. -Full class checking will analyze your classes to make sure that in cases of inheritance features of the parent classes are recheck for validity in the heirs. +Full class checking will analyze your classes to make sure that in cases of inheritance, features of the parent classes are rechecked for validity in the heirs. Here's an example of the kind of error you might expect when compiling with full class checking: @@ -67,7 +67,7 @@ create If we go to the create part of NVP_LIST and add make_sublist to its list of creation procedures, this will fix the problem: create - make, make_from_string, make_from_file_named, make_sublist + make, make_from_string, make_from_file_named, make_sublist So, fix any problems that arise out of turning on full class checking. @@ -328,10 +328,6 @@ To support the "empty array" design, segment_start's postcondition -===Using generic classes=== - - - {{SeeAlso|[[Converting EiffelVision 2 Systems to Void Safety]]}} diff --git a/documentation/current/method/void-safe-programming-eiffel/creating-new-void-safe-project.wiki b/documentation/current/method/void-safe-programming-eiffel/creating-new-void-safe-project.wiki index b73b5f7b..44ea028a 100644 --- a/documentation/current/method/void-safe-programming-eiffel/creating-new-void-safe-project.wiki +++ b/documentation/current/method/void-safe-programming-eiffel/creating-new-void-safe-project.wiki @@ -73,16 +73,16 @@ This change works for all the generic classes in EiffelBase ... except for one: we create my_array with one hundred INTEGER elements. INTEGER is an expanded type, and each element is initialized by applying the default initialization rule for INTEGER, i.e, the integer representation of zero. -However, if my_array had been declared of a type with reference semantics, say STRING (meaning, or course, attached STRING, the default rule would not work well, because the default initialization for references types is Void. +However, if my_array had been declared of a type with reference semantics, say STRING (meaning, or course, attached STRING, the default rule would not work well, because the default initialization for references types is Void which would not be allowed in an array of elements of any attached type. -The solution to this challenge is fairly simple. For arrays of elements of detachable or expanded types, there is no different behavior. For arrays of elements of attached types, then we must be careful. +The solution to this challenge is fairly simple. For arrays of elements of detachable or expanded types, there is no different behavior. When dealing with arrays of elements of attached types, we must be careful. Creating an array using ARRAY's creation procedure make may still be safe in some cases. Specifically, make can be used with arrays of elements of attached types if the arguments have values such that an empty array will be created, that is, when min_index = max_index + 1 -In all other situations involving arrays of elements of attached types, it is not safe to use make to do the creation. Rather, you should use the creation procedure make_filled which takes three arguments. The first is an object of the type of the array, and the second and third are the minimum and maximum indexes, respectively. When the array is created, each of the elements will be initialized with a reference to the object of the first argument. +In all other situations involving arrays of elements of attached types, make may not be used to do the creation. Rather, you should use the creation procedure make_filled which takes three arguments. The first is an object of the type of the array, and the second and third are the minimum and maximum indexes, respectively. When the array is created, each of the elements will be initialized with a reference to the object of the first argument. So, a call using make_filled would look like this: @@ -106,7 +106,7 @@ The complete attached syntax is: In this section, we will see more ways in which to use this versatile language facility. -===As a CAP which yields a local variable=== +===As a CAP-like construct which yields a local variable=== In the introduction to the attached syntax, we used an example which showed how the attached syntax is directly relevant to void-safety. That is, the code: diff --git a/documentation/current/method/void-safe-programming-eiffel/void-safety-background-definition-and-tools.wiki b/documentation/current/method/void-safe-programming-eiffel/void-safety-background-definition-and-tools.wiki index 20d6ac8d..c7737536 100644 --- a/documentation/current/method/void-safe-programming-eiffel/void-safety-background-definition-and-tools.wiki +++ b/documentation/current/method/void-safe-programming-eiffel/void-safety-background-definition-and-tools.wiki @@ -263,7 +263,11 @@ In the case of an actual generic parameter of an attached reference type, all th create my_array.make_filled ("", 1, 100) -The third argument is an object of the actual generic type, in this case an empty STRING. Every entry in the newly created ARRAY will be initialized to reference this object. +The first argument is an object of the actual generic type, in this case an empty STRING. Every entry in the newly created ARRAY will be initialized to reference this object. + + +For more detail on void-safe use of arrays and other generic classes, see the section: [[Creating a new void-safe project#Using generic classes|Using generic classes]]. +