Getting Started with SCOOP
- Creating a new SCOOP project
- Convert an existing project to SCOOP
SCOOP adds only a single keyword to the Eiffel programming language:
separate. In any case in which SCOOP is not enabled, the
separate keyword is ignored, and the SCOOP-specific validity rules are not applied.
In order to enable SCOOP processing in your project, you use the project settings. There are two mandatory settings. One of them is the option Concurrency, and the value you need is SCOOP, as shown in the section of the Project Settings dialog below.
The second setting is the precompiled library. This should either be base-scoop-safe, or nothing at all. A precompiled library which is not built with SCOOP support will not work.
Caution: When you use a precompiled library, the Concurrency setting for that library trumps whatever Concurrency value you have set for the project. So, if you use the "base-safe.ecf" precompiled library, your project will not be SCOOP-enabled regardless of the setting of Concurrency in the Target. Likewise, using the "base-scoop-safe.ecf" precompiled library always produces a SCOOP-enabled project, even if the Target Concurrency setting is None.
Creating a new SCOOP project
Step 1: Create a new project
Create a new project with the EiffelStudio new project wizard by selecting Basic application from the choices under Create project when EiffelStudio opens. The created project will not have SCOOP enabled however (this is true in all EiffelStudio releases so far, but may change in the future). Do not compile the newly created project or precompile a library if asked - it will just be a waste of time.
Step 2: Convert the project
To enable SCOOP, you'll have to do some work on the project settings. Follow the steps in the next section.
Convert an existing project to SCOOP
Step 1: Adjust Concurrency setting
Open the project settings dialogue (Project -> Project settings...). Select your favorite target (usually there's only one) and extend the section Advanced.
In there you'll find the setting Concurrency, which should have a value None for sequential projects. Change it to SCOOP.
In addition to the Concurrency project setting, it is recommended that for new projects you use the settings that guarantee void-safety.
Step 2: Remove the precompiled library
Expand the node Groups in the project settings on the left. If your project uses a precompiled library, you should be able to see and expand the node Precompile as well. Right click on the item (usually something like "base-safe_precompile") in the category Precompile, then select Remove.
Step 3: (Optional) Add precompiled base-scoop-safe to the project
Select the node Groups on the left, and then press Ctrl + P on the keyboard (or select Add Precompile from the toolbox). Note that this only works when there's no existing precompiled library and when the node Groups is highlighted.
In the dialog that opens, select "precomp_base-scoop-safe", then close the dialog by clicking OK.
Step 4: Clean compile
Changing the Concurrency setting and precompiled libraries each would cause you to have to do a clean compile of your system in order to become effective. To do so, close EiffelStudio and reopen it. In the dialog that appears, select the previously modified project and then select the Compile action and add a tick to Clean. At this point, your project should be void-safe and SCOOP enabled.
Step 5: Double-check
Before doing anything after the clean compile, check the warnings section. If EiffelStudio is complaining that some settings could not be applied, something might be wrong with the precompiled library.
To make sure that SCOOP is really enabled, you can insert the following code snippet somewhere in your code:
check_scoop (a_string: separate STRING)
str := a_string
This should trigger a compiler error. If it doesn't, then SCOOP is not correctly set up in your project.