[Colin Paul Adams] Re: Turning off CATCALL detection with gec

Colin Paul Adams <[email protected]> Sat, 18 Dec 2010 16:55:28 +0000
Newsgroups gmane.comp.lang.eiffel.gobo.devel
Message-ID <[email protected]>
I forgot to copy to the list:

>>>>> "Eric" == Eric Bezault <[email protected]> writes:

    Eric> I think that this command-line option is independent of the
    Eric> type of Eiffel config file passed as input.

    Eric> But I'm not sure I understand the problem. Are you saying that
    Eric> gec reports the CAT-call error at compilation time despite the
    Eric> fact that you use the command-line option --catcall=no? 

Yes.

    Eric> that if you use --catcall=no at compilation time, the error
    Eric> will nevertheless be reported at run-time.

I'd better include the complete example:

build.geant:

<?xml version="1.0"?>

<project name="grass" default="help">

        <description>
                description: "Eiffel Ant file for 'grass'"
                system: "Covariance typing demonstration - from Eiffel FAQ LCON"
                copyright: "Copyright (c) 2010, Colin Adams"
                license: "GPL v3"
                date: "$Date$"
                revision: "$Revision$"
        </description>

        <inherit>
                <parent location="${GOBO}/misc/eiffel.eant">
                        <redefine target="init_system"/>
                </parent>
        </inherit>


<!-- Implementation -->

        <target name="init_system">             
	 <set name="system" value="grass"/>
	 <set name="system_dir" value="."/>
        </target>

</project>

system.xace:

<?xml version="1.0"?>

<system name="grass">
        <description>
            system: "Covariance typing demonstration - from Eiffel FAQ LCON"
            copyright: "Copyright (c) 2010, Colin Adams"
            license: "GPL v3"
            date: "$Date$"
            revision: "$Revision$"
        </description>

        <root class="ROOT" creation="make"/>
        <option name="console_application" value="true"/>
        <option if="${GOBO_EIFFEL}=ge">
                <option if="${BOEHM_GC}">
                        <option name="garbage_collector" value="boehm"/>
                </option>
        </option>
        <option unless="${DEBUG}">
                <option name="assertion" value="none"/>
                <option name="finalize" value="true"/>
        </option>
        <option if="${DEBUG}">
               <option name="assertion" value="all"/>
                <option name="finalize" value="false"/>
        </option>

        <cluster name="grass" location="."/>

        <mount location="${GOBO}/library/kernel/library.xace"/>
        <mount location="${GOBO}/library/structure/library.xace"/>
        <mount location="${GOBO}/library/kernel.xace"/>
</system>


root.e:

class ROOT

create

	make

feature {NONE} -- Initialization

	make is
			-- Run the system without covariance.
		local
			l_herb1, l_herb2: HERBIVORE
			l_plant: PLANT
			l_grass: GRASS
			l_cow: COW
		do
			create l_plant
			create l_grass
			create l_herb1.make
			create l_herb2.make
			l_herb1.eat (l_plant)
			l_herb2.eat (l_grass)
				-- test1, so far, so good
			create l_cow
			l_cow.eat (l_grass)
			-- this is statically rejected - no problems: l_cow.eat (l_plant)
				-- test2, so far, so good
			l_herb1.diet.put_last (l_plant)
			l_herb1.diet.put_last (l_grass)
			l_herb1.digest
				-- no problem - herbivores can eat grass
			l_cow.diet.put_last (l_plant)
			l_cow.diet.put_last (l_grass)
			l_cow.digest
			
		end

end

plant.e:

class PLANT

end

grass.e:

class GRASS

inherit

	PLANT

end

herbivore.e:

class HERBIVORE

create

	make

feature {NONE} -- Initialization

	make is
			-- Initialize.
		do
			create diet.make_default
		end

feature -- Access

	diet: DS_ARRAYED_LIST [PLANT]
			-- Items we can eat

feature -- Basic operations
	
	eat (a_food: PLANT) is
			-- Say what we are eating
		do
			print ("Eating " + a_food.generator + "%N")		
		end


	digest is
			-- Eat entire diet (greedy!).
		local
			l_cursor: DS_ARRAYED_LIST_CURSOR [PLANT]
		do
			from
				l_cursor := diet.new_cursor
				l_cursor.start
			until
				l_cursor.after
			loop
				eat (l_cursor.item)
				l_cursor.forth
			end
		end

invariant
	
	diet_not_void: diet /= Void

end

cow.e:

class COW                  

inherit                  

	HERBIVORE             
      redefine eat end
	
feature -- Basic operations

	eat (a_food: GRASS) is
			-- <Precursor>
		do
			Precursor (a_food)
		end

end

-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d