Nested Operation Calls issue from use manual

Jun Lin
  • Jun Lin

    Jun Lin - 2012-01-18

    In the use documentation, the example (3.3 Nested Operation Calls) doesn't work as expected. When I try to use the following command to compute 3!, an error occurs. Would you please help check if anything wrong?
    Error: <input>:1:0: Operation 'fac' is defined by a OCL expression and cannot be entered with openter.
    USE tool version: 3.0.1
    use> !create r : Rec
    use> !openter r fac(3)
    model NestedOperationCalls
    class Rec
    fac(n : Integer) : Integer =
    if n <= 1 then 1 else n * self.fac(n - 1) endif

  • Lars Hamann

    Lars Hamann - 2012-01-23

    Hi, thanks for the post.
    The issue is, that the documentation is not up to date.

    You have several possibilities for this:
    1. Don't use openter. You can get the result by simply enter ?r.fac(3)
    2. Use the operation fac_s from the SOIL example located at \examples\soil\ppc\fac\fac.use

    If you are interested in the details: Starting with USE 3 one can specify implementation with a simple imperative language called SOIL. For this, we needed to change the behavior of the openter / opexit commands.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks