liberty-eiffel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NOOB - compiling error


From: Raphael Mack
Subject: Re: NOOB - compiling error
Date: Mon, 27 Feb 2023 20:30:51 +0100
User-agent: Evolution 3.38.3-1+deb11u1

Hi Duke,

the code example is using the ISE dialect of Eiffel, which differs in
some (small) aspects. One is the (rather theoretical) loop variant.

It is an integer expression, that shall decrease each time the loop
body executes and always stays non-negative. By that the loop is
guaranteed to terminate - which is a nice property of a loop, but it is
not used very often in real eiffel programs.

The difference between ISE Eiffel an LibertyEiffel is the position
where the variant is given. In Liberty you need to move it before the
exit condition block starting with "until":
https://wiki.liberty-eiffel.org/index.php/Syntax_diagrams#Loop

    invariant
        bottles <= 99 and bottles >= 1
    variant
        bottles
    until


Additionally you should add "{ANY}" after "create" in line 4:

create {ANY}
    make

and replace the {NONE} in line 67 by {}

Last but not least you'll recognize, that LibertyEiffel doesn't (yet)
support automatic type conversion (which has its pros and cons) and
therefore
    print (bottles)
will not compile, as the type of bottles is INTEGER and print takes a
STRING. So do an explicit conversion in the 3 places where it's called:
    print (bottles.out)

Maybe a good idea would be to dig into the examples in the tutorial
shipped with LibertyEiffel, to get started with this nice language.

Hope this helps,
Rapha

Am Montag, dem 27.02.2023 um 09:22 -0700 schrieb Duke Normandin:
> Hello - Eiffel noob here!
> 
> se c BOTTLES.e
> 
> [/quote]
> ****** Warning: A missing client list is interpreted as {ANY}. It
> is better to be explicit.
> 
> Line 5 column 2 in BOTTLES
> (/home/dnormandin/programming/eiffel/BOTTLES.e): make
>    ^   
> ------
> ****** Fatal Error: In compound (loop body). Instruction or keyword
> "end" expected.
> 
> Line 30 column 4 in BOTTLES
> (/home/dnormandin/programming/eiffel/BOTTLES.e): variant
>          ^      
> ------
> Error occurs while compiling. Compilation process aborted.
> {/quote]
> 
> The code is from rosettacode.org
> How do I fix these errors? 
> Where is a total Eiffel noob non-academic tutorial please? TIA ..





reply via email to

[Prev in Thread] Current Thread [Next in Thread]