eiffel

Getting stack trace from geant

爱⌒轻易说出口 提交于 2019-12-14 04:02:33
问题 I'm trying to compile a project (see this SO question) using Gobo compiler and its tools and I'm getting error messages refering to standard library equal(..) . I'm sure that error is somewhere in the code I have and not in standard library but I don't know how to get some more info from geant . I'd like to know which class, function, line of code from my code invoked equal(..) or any other standard library function which might call it. And yes, I've already tried going through all equal(..)

Is it possible to enforce Design by Contract checks at compile time?

冷暖自知 提交于 2019-12-11 17:18:18
问题 Reading Design by Contract tutorial I stumbled upon the following line: Contracts in Eiffel are not just wishful thinking. They can be monitored at run time under the control of compilation options. followed by explanations that they will throw exceptions when fail. It makes me think that all the require ensure invariant all checks can be either performed at runtime or turned off. Is this correct? Or they can be enforced at compile time as well using appropriate compiler options? 回答1: There

Eiffel Web Framework, app run on linux raises `Address already in use: IO_FAILURE raised`

核能气质少年 提交于 2019-12-11 16:40:24
问题 After stopping an EWF app and starting it again in a Address already in use: c_bind Address already in use: IO_FAILURE raised As explained here, it seems that TCP socket timeout is not available for some time before being released by OS. 回答1: The best workaround I found is sudo sh -c 'echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle' Credits to this answer I believe that the idea of the socket being unavailable to a program is to allow any TCP data segments still in transit to arrive, and get

STRING_8 does not conform to STRING_UC in is_equal

▼魔方 西西 提交于 2019-12-11 15:59:18
问题 I'm trying to build xplain2sql using Gobo compiler and its tools. After issuing geant compile command I get a lot of similar errors: [CATCALL] class SQL_GENERATOR_TSQL65 (SQL_GENERATOR,2610,5): type 'STRING_8' of actual argument #1 does not conform to type 'UC_STRING' of formal argument in feature `is_equal' in class 'UC_STRING' Above error refers to the last line of this code: sql_infix_expression (a_left: XPLAIN_EXPRESSION; an_operator: STRING; a_right: XPLAIN_EXPRESSION): STRING -- SQL

How to format a DOUBLE to print only two decimals in Eiffel?

耗尽温柔 提交于 2019-12-11 02:39:52
问题 In eiffel how do you make it so that the number. 118.1999999999999 prints to: 118.20 In other language is simply a matter of printf but there seems no to be a way to do that easily in Eiffel. 回答1: You should use the class FORMAT_DOUBLE local fd: FORMAT_DOUBLE do create fd.make (5, 3) print (fd.formatted ({REAL_64} 12345.6789)) --> "12345.679" print (fd.formatted ({REAL_64} 12345.6)) --> "12345.600" print (fd.formatted ({REAL_64} 0.6)) --> "0.600" create fd.make (10, 2) fd.right_justify print

Immutable class in Eiffel

久未见 提交于 2019-12-07 04:03:50
问题 I'm trying to make an immutable POINT class in Eiffel. Is the code below defines one? The {NONE} accessibility for the x and y fields is enough for it? Can I write something to the class invariant like x = x' , or how else can I achieve immutability? class POINT create make feature {NONE} x: DOUBLE y: DOUBLE feature make (x_: DOUBLE; y_: DOUBLE) do x := x_ y := y_ ensure set: x = x_ and y = y_ end feature --accessors get_x: DOUBLE do Result := x ensure Result = x end end 回答1: Eiffel does not

Is there an beautiful way to assert pre-conditions in Java methods?

心不动则不痛 提交于 2019-11-30 12:17:40
A lot of my functions have a whole load of validation code just below the declarations: if ( ! (start < end) ) { throw new IllegalStateException( "Start must be before end." ); } I'd like to precisly specify the valid ranges of certain inputs - for example a A > B, C => 1 or str_d.length() > 0. Given that some of my functions have quite a lot of arguments which must be validated I can end up writing a lot of boiler-plate just to validate the pre-conditions. I'm writing a library which is mainly going to be used by non-technical developers, we've found that validating function inputs is the

Is there an beautiful way to assert pre-conditions in Java methods?

北城余情 提交于 2019-11-29 17:53:04
问题 A lot of my functions have a whole load of validation code just below the declarations: if ( ! (start < end) ) { throw new IllegalStateException( "Start must be before end." ); } I'd like to precisly specify the valid ranges of certain inputs - for example a A > B, C => 1 or str_d.length() > 0. Given that some of my functions have quite a lot of arguments which must be validated I can end up writing a lot of boiler-plate just to validate the pre-conditions. I'm writing a library which is

Object-Oriented Callbacks for C++?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 02:13:37
Is there some library that allows me to easily and conveniently create Object-Oriented callbacks in c++? the language Eiffel for example has the concept of "agents" which more or less work like this: class Foo{ public: Bar* bar; Foo(){ bar = new Bar(); bar->publisher.extend(agent say(?,"Hi from Foo!", ?)); bar->invokeCallback(); } say(string strA, string strB, int number){ print(strA + " " + strB + " " + number.out); } } class Bar{ public: ActionSequence<string, int> publisher; Bar(){} invokeCallback(){ publisher.call("Hi from Bar!", 3); } } output will be: Hi from Bar! 3 Hi from Foo! So - the