liberty-eiffel
[Top][All Lists]
Advanced

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

[Liberty-eiffel] reverse-assigment problem


From: Laurie Moye
Subject: [Liberty-eiffel] reverse-assigment problem
Date: Fri, 23 Jan 2015 16:11:20 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

Hi,

Here is a structure that I used successfully in SmallEiffel, but it
won't compile in Liberty.
*****************************
class TEST_REVERSE_ASSIGNMENT [ G ]

create {ANY}
   make

feature {ANY}           -- Public features
   make (g : G) is
      local
         s : STRING
      do
         s ?= g
         io.put_string(s)
      end
        
-------------------------------------------------------------------------------
end                     -- class TEST_REVERSE_ASSIGNMENT
*****************************
class RUN_TEST

create {ANY}
   run

feature {ANY}           -- Public features
   run is
      local
         string_thing : TEST_REVERSE_ASSIGNMENT[ STRING ]
      do
         create string_thing.make("Hello World%N")
      end
        
-------------------------------------------------------------------------------
end                     -- class RUN_TEST
*****************************
The attempt to compile gives:
*****************************
ceres/liberty-conversion: compile -boost -no_gc run_test -o run_test
****** Fatal Error: Invalid assignment attempt ("?="). The left-hand
side expression must conform to the right-hand side. The expression
`s' is of type STRING while the expression `g' is of type ANY.

The source lines involved by the message are the following:

Line 11 columns 4, 9 in TEST_REVERSE_ASSIGNMENT
(/home/laurie/rbs/liberty-adler/from-SE-0.75/liberty-conversion/test_reverse_assignment.e):
         s ?= g
         ^    ^
------
Error occurs while compiling. Compilation process aborted.
*****************************
I don't understand this. Surely _everything_ conforms to ANY?
It works if I declare:
class TEST_REVERSE_ASSIGNMENT [ G -> HASHABLE ]
or (I assume) any of the many other classes inherited by STRING.

Searching to see if I could find anything about this online, the only
thing I came up with is that "x ?= y" has been abandoned in ECMA-367 and
marked as obsolete in EiffelStudio. Is there some other mechanism I
should be using?

Best wishes,
          Laurie




reply via email to

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