Forum

  • Jun 26
    Re: repeated inheritence of same class
    There is another solution that does NOT involve inheritance. If both of the ancestor classes are not deferred (but implemented), then one can do the following: 1. create two features—one for each class. - You can place these in their own feature group and export them to {NONE} if
  • Jun 26
    Re: Re[2]: [eiffel-users] repeated inheritence of same class
    My installed version of Eiffel (17.05) is horked, and so while I was able to compile the following code without error, I couldn't test it to see the results. Hopefully it can get you a bit closer to what you are trying to accomplish. class PK_DB_ENTITY inherit CONSTRAINTABLE rename constrain
  • Jun 26
    Re[2]: [eiffel-users] repeated inheritence of same class
    The select clause specifies which version should be used when making a call c.constraint when c is declared with type CONSTRAINTABLE at compile time, but is attached to an object of type PK_DB_ENTITY at run-time. As currently written, class PK_DB_ENTITY has two versions of the feature, and
  • Jun 26
    Re: [eiffel-users] repeated inheritence of same class
    this case is the one I want and there could ve more methods implementing a "to_constraint_as_..." which I prefered trying to stick to eiffel nomenclature as I wrote. Any suggestion is in all case mostly welcome On Tue, Jun 25, 2019, 21:24 Gachoud Philippe wrote: > thx it
  • Jun 26
    Re: [eiffel-users] repeated inheritence of same class
    I'd like both methods with 2 different implementation renamed as shown by primary_key_constraint: CONSTRAINT require else valid_primary_key (primary_key) do create {FIELD_CONSTRAINT} Result.make (table_name, Primary_key_db_column_name, {CONSTRAINT}.Equal_op
  • Jun 26
    Re: [eiffel-users] repeated inheritence of same class
    thx it would have been nice to have this doc for me at the beginning of my tripulations with multiple inheritence! but as I remember (but not where into the library) there are cases of direct repeated inheritence where B inherits 2 times from A into the same class. @ this time it was difficult
  • Jun 25
    Re: [eiffel-users] repeated inheritence of same class
    Which one do you want as default? Personally, I do not think that it matters which you choose, since it is likely that you will be only using this class through the DB_ENTITY hierarchy. On Tue, Jun 25, 2019, 3:54 PM Gachoud Philippe wrote: > thx for your explanations but
  • Jun 25
    RE: [eiffel-users] repeated inheritence of same class
    Hi Philippe These might help, a little. The document form ("Adapting ...") is rather old, and there have been language changes in the last decade :) But, the concepts are still there. The presentation form ("Re-What...") is much fresher (and a whole lot shorter) R -------- Original Message
  • Jun 25
    Re: [eiffel-users] repeated inheritence of same class
    thx for your explanations but still are fuzzy for me... how can I reach my goal of having 2 features with 2 different implementation into same class with 2 times inheritence from CONSTRAINED? Still dont got it sry... -- ********************************************** Philippe Gachoud Puerto
  • Jun 25
    Re: repeated inheritence of same class
    Take careful note of the error text ... it tells you what to do. Use the "Select clause" in the inheritance part of the class to tell the Eiffel compiler from where to "select" the version of the routine you want in the Current class. Note that between where you created the ancestor and the
  • Jun 25
    repeated inheritence of same class
    Hi all, sure this topic was already discussed, but could not find a quick and good answer to that. I think code talks better to our ears, but .... The semantic for me is to have the same semantic for a method that returns a DB constraint and could have some ensures and contract.... in this case
  • Jun 25
    Re: [eiffel-users] repeated inheritence of same class
    The compiler is correct. When you use a feature with the CONSTRAINT type and you call constraint, which one will be used? This is the purpose of select. With multiple inheritence, you can set an instance of your class to a variable/feature results of type DB_ENTITY or CONSTRAINT or any
  • Jun 24
    Re: [eiffel-users] string as string_n
    Not sure about the historical reason to choose those names. But I think initially it was used to help with refactoring and renaming, for instance, old name WIDE_CHARACTER was renamed as new CHARACTER_32. So code could use new class name, but also old class name for existing code. Note the IDE will
  • Jun 24
    RE: [eiffel-users] unable to set font in rich text
    Hi Jocelyn Looking at EV_FONT, it does show some signs of age, but then, don't we all :) For example, the note at the top of the class says to use a feature that no longer exists. I whipped up a child of EV_FONT, redefining the make_with_values routine to add a preferred family for most of the
  • Jun 24
    RE: [eiffel-users] string as string_n
    Not quite the answer to my question, but very helpful and clear. Thanks R -------- Original Message -------- Subject: Re: [eiffel-users] string as string_n From: Germán_Arias Date: Sun, June 23, 2019 7:43 pm To: eiffel...@googlegroups.com Hi, Not sure if I understand your
  • Jun 24
    Re: [eiffel-users] string as string_n
    Hi, may I ask why this mapping is done with old as STRING and new as STRING_8? what is the semantic of that? Thx On Mon, Jun 24, 2019 at 4:57 AM Jocelyn Fiat wrote: > There is a mapping, i.e STRING = STRING_8, same as REAL=REAL32, > INTEGER=INTEGER_32 , ... > > For the
  • Jun 24
    RE: [eiffel-users] string as string_n
    I'll check 'em out. Thanks! R -------- Original Message -------- Subject: Re: [eiffel-users] string as string_n From: Jocelyn Fiat Date: Mon, June 24, 2019 4:58 am To: Eiffel Users Also look at https://www.eiffel.org/doc/eiffelstudio/Type_mapping
  • Jun 24
    Re: [eiffel-users] unable to set font in rich text
    Hi Roger, I agree for simple case, it should not be needed to use preferred family, we continue the investigation to see why the predefined family values do not have the expected behavior. My message was mostly to provide you with a simple solution you can use right now. Regards, -- Jocelyn On
  • Jun 24
    Re: [eiffel-users] string as string_n
    Also look at https://www.eiffel.org/doc/eiffelstudio/Type_mapping On Mon, Jun 24, 2019 at 10:57 AM Jocelyn Fiat wrote: > There is a mapping, i.e STRING = STRING_8, same as REAL=REAL32, > INTEGER=INTEGER_32 , ... > > For the details, you can look at > https://svn.eiffel.com/eif
  • Jun 24
    Re: [eiffel-users] string as string_n
    There is a mapping, i.e STRING = STRING_8, same as REAL=REAL32, INTEGER=INTEGER_32 , ... For the details, you can look at https://svn.eiffel.com/eiffelstudio/trunk/Src/library/base/base.ecf > Regards, -- Jocelyn On Mon, Jun 24, 2019 at 1:43 AM
  • Jun 23
    Re: [eiffel-users] string as string_n
    Hi, Not sure if I understand your question at all. But you can explicitly tell the compiler when a string is STRING_32 or should be converted to STRING_32. For example: {STRING_32} "Hello world" or {STRING_32} some_thing.out Many features uses STRING_8. So if you later uses this string whit
  • Jun 23
    string as string_n
    I don't remember, and can't seem to find, how one goes about setting "STRING" to mean either STRING_8 or STRING_32. I created a new hello_world project and, though it didn't ask, it seems to equate STRING to STRING_8 (as evidenced by things like "out" in ANY). When I try to enter "STRING" in the
  • Jun 23
    Re: [eiffel-users] Is "!!" deprecated?
    Yes. Use create instead. On Sat, 22 Jun 2019 at 22:27, Hank Lenzi wrote: > Hello - > > Pardon the newbie question... > Reading old Eiffel books, I keep seeing "!!", as in: > > class X > > creation > make > > feature > test: REAL > format: FORMAT_DOUBLE > >
  • Jun 23
    Re: [eiffel-users] Newbie question here about "!!"
    Hi Hank, The !! creation syntax has been obsolete for about 20 years. Ace files were replaced by ecf files about 15 years ago. The book you are referring to must be very old, and the list of changes to Eiffel in that time would be very long. - Peter > On 23 Jun 2019, at 09:10, Hank Lenzi
  • Jun 22
    Re: [eiffel-users] Newbie question here about "!!"
    There is help out there. Take a look at www.eiffel.org. Search for reserved words will provide a quick list that you can use to map from the old usage to the new. In addition there are examples, etc, and there might be a page that provides the changes from the old version (I remember seeing
  • Jun 22
    Re: [eiffel-users] Newbie question here about "!!"
    be great because of Void safety, etc). You now use "create format.make (8, 2)" instead. > I guess if authors just put a webpage, updating details (e.g., ace files, etc.) it would greatly help. Thanks. -- Hank
  • Jun 22
    Newbie question here about "!!"
    Hi all - Pardon the totally non-deep question. I am just learning Eiffel, so I got me a few books. They all use "!!", as in Rist's book, like so: class X creation make test: REAL format: FORMAT_DOUBLE make is -- show how real formatting is done do
  • Jun 22
    Re: [eiffel-users] Newbie question here about "!!"
    Yes, it is. Sadly, no one has come out with an updated book (which would be great because of Void safety, etc). You now use "create format.make (8, 2)" instead. On Sat, Jun 22, 2019, 5:22 PM Hank Lenzi wrote: > Hi all - > > Pardon the totally non-deep question. > I am just
  • Jun 22
    RE: [eiffel-users] unable to set font in rich text
    Hi Jocelyn I just tried that, and it actually does work, but I'm a bit surprised that a feature that seemingly sets the font family doesn't actually do so unless augmented with a preferred family. Shouldn't EV_FONT use default values? It's not like Times New Roman, Courier New, and Arial are
  • Jun 22
    Re: Problems installing Eiffel on the Mac
    I would be interested to install Eiffel Studio on my Mac but I use brew rather than MacPorts. I see that there is indeed an install formula offerred there (https://formulae.brew.sh/formula/eiffelstudio#default). Since the instructions do not refer to this option, I assume it is not officially
  • Jun 11
    € Symbol from commandline (Arguments)
  • Apr 20
    Problems compiling Traffic library

    I attempted to install the Traffic library for the book "A Touch of Class" but was not able to compile the examples. EiffelStudio complained about a base2.ecf file. Error code: VD00

    General configuration parsing error. What to do: fix the configuration file.

    Could not open file: \base2.ecf $EIFFELBASE2\base2.ecf

    base2.ecf is found in where Windows installed Eiffel: C:\Program Files\Eiffel Software\EiffelStudio 18.11 GPL\unstable\library\base2.ecf The offending line of code seems to be this in the Traffic configuration files:

    I have attempted to change this configuration file pointing directly to where the file is, using the actual path, to no avail.

  • Apr 05
    Eiffel: passing argument to agent received as argument

    I'm really stuck in how to pass an argument to a second level of an Eiffel agent call. Hope my example is enough self explaining:

    main_call
        do
            b (agent d(?, ?))
        end
    
    b (a_proc: PROCEDURE[STRING])
        local
            l_something_else: INTEGER
        do
            l_something_else := 1
    --        z("a_line", a_proc(l_something_else)) -- How can I pass at this stade l_something_else to the d procedure!!!
        end
    
    d (line: STRING; something_else: INTEGER)
        do
    --        do_some_stuff_with_line (line, something_else)
            do_nothing
        end
    
    z (a_line: STRING; a_proc: PROCEDURE[STRING])
        do
            a_proc.call([a_line])
        end
    

    I would have liked to be able to do something like

    z("a_line", a_proc(?, something_else))
    

    But its not possible, as I try with the agent keyword, the a_proc argument is not recognized!

    So what would be the syntax? I even tried to add an argument to a_proc with a_proc.set_operands but am lost with the OPEN_ARGS class

    Implementation case

    If you need a goal... just imagine I'd like to have 2 different implementations of the d function, and in my case its using UT_CSV_HANDLER that I'd like to have 2 different functions for each line of a CVS

    The following code gives a Non-compatible actual argument in feature call

    Feature: import_from_csv_impl
    Called feature: import_from_csv_impl (a_rest_request: REST_REQUEST; a_procedure: PROCEDURE [DS_ARRAYED_LIST [STRING_8], INTEGER_64, STRING_8]): [detachable like items] detachable SIT_LINKED_LIST [MEASURING_POINT] from MEASURING_POI...
    Argument name: ia_name
    Argument position: 2
    Formal argument type: STRING_8
    Actual argument type: INTEGER_64
    Line: 258
                    ia_procedure.call (ia_measuring_point_id, ia_name)
    ->            end (?, l_measuring_point_id, l_s)
                l_csv_handler.read_file (l_is, l_partially_closed)
    

    The complete example:

    -- Main call
    import_from_abb_csv (a_rest_request: REST_REQUEST): detachable like items 
        do
            Result := import_from_csv_impl (a_rest_request, agent impl_for_each_csv_line_import_from_abb_csv)
        end
    
    -- Second call
    import_from_csv_impl (a_rest_request: REST_REQUEST; a_procedure: PROCEDURE[DS_ARRAYED_LIST [STRING_8], INTEGER_64, STRING]): detachable like items
        local
            l_csv_handler: UT_CSV_HANDLER
            l_is: KL_STRING_INPUT_STREAM
            l_measuring_point_id: INTEGER_64
            l_s: STRING
            l_partially_closed: PROCEDURE[DS_ARRAYED_LIST[STRING]]
        do
            l_s := "whatever"
            l_measuring_point_id := 12
            create l_csv_handler.make_with_separator (',')
    
            l_partially_closed := agent (i_al: DS_ARRAYED_LIST[STRING]; ia_measuring_point_id: INTEGER_64; ia_name: STRING; ia_procedure: PROCEDURE[INTEGER_64, STRING])
                do
                    ia_procedure.call (ia_measuring_point_id, ia_name)
                end (?, l_measuring_point_id, l_s)
    
            l_csv_handler.read_file (l_is, l_partially_closed)
    
        end
    
    -- end call
    impl_for_each_csv_line_import_from_abb_csv (a_csv_line: DS_ARRAYED_LIST [STRING_8]; a_measuring_point_id: INTEGER_64; l_cu_name: STRING)
        do
            -- do_my_business
        end
    
    
    -- for information signature of read_file is:
    --     read_file (a_file: KI_TEXT_INPUT_STREAM; a_action: PROCEDURE [DS_ARRAYED_LIST [STRING]])
    
  • Apr 05
    Eiffel: type conformance, how to give a type instead of an instance

    General

    I don't understand why there are like 2 generating_type kinds, the one with exclamation point, and the other not.

    My case

    I have a function returning a DB_SERVICE[G] from a given instance from a collection of db_services so that from another service I can retrieve it and call it. When I pass an instance generating_type to that function, the conforms_to returns True, as when I give ({ENUMERATE}).generating_type it doesn't.

    Why is that so?

    -- Humanly unreadable
    if attached {ENUMERATE_DB_SERVICE} {SIT_ENVIRONMENT}.app_instance.db_service_from_entity_type (item_prototype.charge_unit_relationship.secondary_prototype.an_index_relationship.secondary_prototype.generating_type) as l_enum_dbs then
    
    -- Humanly readable but not working
    if attached {ENUMERATE_DB_SERVICE} {SIT_ENVIRONMENT}.app_instance.db_service_from_entity_type (({ENUMERATE}).generating_type) as l_enum_dbs then
    

    My function

    db_service_from_entity_type (an_entity_type: TYPE[detachable DB_ENTITY]): detachable like db_services.item
        do
            across
                db_services as l_dbs
            until
                Result /= Void
            loop
                if l_dbs.item.item_prototype.generating_type.conforms_to (an_entity_type) then
                    Result := l_dbs.item
                end
            end
        ensure
            service_found: attached Result
        end
    

    Edit (20190405-11:26 UTC)

    As the screenshot shows, giving {ENUMERATE} instead of ({ENUMERATE}).generating_type doesn't work either

    enter image description here

  • Mar 29
    Eiffel: Creating a datetime with '' format

    Seems I'm wrong creating a datetime from string using this method, any idea why? The precondition violates on date_time_valid: date_time_valid (s, code)

    create l_date_time.make_from_string ("2019-03-28T15:28:02Z", "yyyy-mm-ddThh:mi:ssZ")
    
  • Mar 10
    Eiffel shortest statement for object creation and result of function

    If I'd like to add a DATE_TIME to a logger for example I'd like to avoid creating a local variable for that. Is there any similar statement as

    create {DATE_TIME}.make_now.formatted_out ("yyyy-mm-dd hh:mi:ss")
    

    which is not possible?

  • Feb 18
    Eiffel: a way to display assertion violation on runtime of executable

    As I have the choice on finalizing a project to keep assertions, I'd think that assertion violation would be shown or displayed on console (hopefully on stderr on linux). What would be the proper way to do such, like seems that I have to add it or enable something to get it...

  • Feb 11
    Eiffel: how do I set the command line arguments of an autotest?

    Some of my tests needs something like

    {EXECUTION_ENVIRONMENT}.arguments.separate_character_option_value ('l')
    

    to be attached (not Void), how do I set commandline arguments to eiffel autotest?

  • Feb 11
    Eiffel: a proper way to inherit from a class and convert Current object to it

    It's not the first time I'm trying to inherit from a class and convert an object to it, in this case extend functionalities of HTTP_CLIENT_RESPONSE with valid_http_response => response.status = 200, valid_http_json_body => validate json content, etc...

    For that, I'd like to inherit from HTTP_CLIENT_RESPONSE and add features and create my custom DB_ENTITY_HTTP_CLIENT_RESPONSE from an HTTP_CLIENT_RESPONSE

    test_case
        local
            l_http_client_r: HTTP_CLIENT_RESPONSE
            l_db_entity_http_client_r: DB_ENTITY_HTTP_CLIENT_RESPONSE
        do
            l_http_client_r := execute_get("someURL") -- returns an HTTP_CLIENT_RESPONSE
            l_db_entity_http_client_r := l_http_client_r
            assert("valid response", l_db_entity_http_client_r.valid_response)
        end
    

    it seems I've difficulties having the internal properties set... what would be the best way to do this? I had the same case trying to create a WATT class inheriting from NATURAL_32 which is an expanded.

    In my strategy, I tried to call in creator

    • a parent creation procedure
    • then call a deep_copy

    Here is the rest of my class attempt:

    class
        DB_ENTITY_HTTP_CLIENT_RESPONSE
    
    inherit
        HTTP_CLIENT_RESPONSE
    
    create
        make_from_http_client_response
    
    convert
        make_from_http_client_response ({HTTP_CLIENT_RESPONSE})
    
    feature -- Initialization
    
        make_from_http_client_response (a_client_response: HTTP_CLIENT_RESPONSE)
            do
                make (a_client_response.url)
                deep_copy (a_client_response)
            end
    
    feature -- Status report
    
        valid_response: BOOLEAN
            do
                Result := status = 200
            end
    

    The only way I found working for now is by setting all attributes to other which is the semantic of deep_copy normally...

    make_from_http_client_response (a_client_response: HTTP_CLIENT_RESPONSE)
        do
            make (a_client_response.url)
            set_body (a_client_response.body)
            set_http_version (a_client_response.http_version)
            set_error_occurred (a_client_response.error_occurred)
            set_error_message (a_client_response.error_message)
            set_raw_header (a_client_response.raw_header)
            set_status_line (a_client_response.status_line)
            ... I surely forgot something...
        end
    
  • Feb 10
    Eiffel: is there a way with do_all or do_if to search for an element in a collection without having to write a whole feature?
    across
        collection as l_item
    until 
        Result /= Void
    loop
        if l_item.item.name.is_equal ("foo") then
            Result := l_item.item
        end
    end
    

    is there a way and if so which one to do something like

    collection.do_if (agent ...)
    

    an example of use can be:

    search_item_with_id (an_id: INTEGER)
            -- Moves items cursor if not found is_after
        local
            l_found: BOOLEAN
        do
            from
                items.start
            until
                items.after or l_found
            loop
                l_found := items.item.primary_key = an_id
                if not l_found then
                    items.forth
                end
            end
        ensure
            cursor_on_element_if_found: not items.after implies items.item.primary_key = an_id
        end
    
  • Feb 01
    Eiffel: ODBC Dealing with BIGINT

    Eiffel

    Seems I'm getting an INTEGER_32_REF from a BIGINT from ODBC with Eiffel DB_SELECTION.cursor. Sometimes I seem to have the adecuate value, but sometimes not...

    946383958 => good INTEGER_32_REF (id->4 of following table)
    9475984837 => 886050245 WRONG INTEGER_32_REF (id->4 of following table)
    
    646383958 => good INTEGER_32_REF (id->3 of following table)
    6475984837 => -2113949755 WRONG INTEGER_32_REF (id->4 of following table)
    
    ...
    

    It seems to behave like not treating the BIGINT and giving the INTEGER_32_REF value directly interpreted from the DB value, typical case passing over the 2^32

    Postgresql

    Having a table with following data as electricity_amount BIGINT NOT NULL DEFAULT 0

    id |   a_date   |  amount   | electricity_amount | consumption_sector_id | electricity_rate_id
    ----+------------+-----------+--------------------+-----------------------+---------------------
    1 | 2019-01-01 | 746383958 |         7475984837 |                     1 |                   1
    2 | 2019-02-01 | 846383958 |         8475984837 |                     1 |                   1
    3 | 2019-03-01 | 646383958 |         6475984837 |                     1 |                   1
    4 | 2019-04-01 | 946383958 |         9475984837 |                     1 |                   1
    

    enter image description here

  • Jan 31
    Eiffel: non-compatible actual argument in feature call

    I don't understand why it is so.

    • If I say attached {G} it works
    • If I say nothing which would be the expected behavior for me calling_entity: detachable RELATED_DB_ENTITY should be conform (once attached) to G which is -> DB_ENTITY
    • If I say DB_ENTITY it doesn't
    • If I say RELATED_DB_ENTITY either does it pass

    Why do I have to specify {G}???

    SIT_HANDLER

    class
        SIT_HANDLER[G -> DB_ENTITY create default_create, make_from_db_service, make_from_json end]
    
    feature --
    
        some_feature
            do
                if attached {G} l_rest_request.calling_entity as l_calling_entity then
                    db_service.set_item_prototype (l_calling_entity) -- Complains here!!!!!!!!!!!!
                    db_service.load_with_relationships (l_rest_request)
                ...
            end
    end -- class
    

    REST_REQUEST

    class
        REST_REQUEST
    
    feature -- Access
        calling_entity: detachable RELATED_DB_ENTITY -- RELATED_DB_ENTITY inherits DB_ENTITY
    ...
    end -- class
    

    DB_SERVICE

    class
        DB_SERVICE [G -> DB_ENTITY create default_create, make_from_db_service, make_from_json end]
    
    feature -- Status setting
    
        item_prototype: G
    
        set_item_prototype (v: like item_prototype)
            do
                item_prototype := v
            ensure
                item_prototype = v
            end
    
    ...
    end -- class
    

    enter image description here

  • Jan 30
    Eiffel: setting a constant with reference to other class constant

    How to set a constant refering to another class constant in Eiffel?

    Something like that doesn't compile unfortunately

    Default_log_level: like {MY_LOGGER}.log_level = {MY_LOGGER}.Log_level_info
    
  • Jan 27
    Eiffel: REAL_32.to_double gives a strange value

    Trying to transform a real_32 to real_64, I'm getting

    real_32: 61.55
    real_64: 61.54999923706055 
    

    Am I wrong with the to_double function?

    enter image description here

  • Jan 26
    Eiffel: multilines string formating

    Didn't find a better way to format a multiline string than this way... seems complicated. What would be the best way to format this type of code?

    l_qry := "SELECT%
        %    * %
        %FROM %
        %    enumerate %
        %WHERE %
        %    " + {like item_prototype}.Primary_key_db_column_name + " = " + l_category_id + " %
        %UNION %
        %   SELECT %
        %       e.* %
        %   FROM %
        %       enumerate e %
        %INNER JOIN  %
        %   enumerates_leaves s ON s." + {like item_prototype}.Primary_key_db_column_name + " = e." + {like item_prototype}.Category_db_column_name + " %
        %) SELECT * FROM enumerates_leaves WHERE enumerates_leaves." + {like item_prototype}.Category_db_column_name + " IS NOT NULL;"
    
  • Jan 26
    eiffel: does the across structure move the cursor of current iterable structure?

    I was wondering if the across structure uses an own cursor or a separated one? does it ensure that cursor hasn't moved and if so how can it be expressed for other examples?

  • Jan 25
    Eiffel: how to use old keyword in ensure contract clause with detached

    How to use the old keyword into ensure clause of a feature, the current statement doesn't seem to be valid at runtime

    relationships: CHAIN -- any chain
    
    some_feature
        do
        (...)
        ensure
            relationship_added: attached relationships as l_rel implies
                attached old relationships as l_old_rel and then
                l_rel.count = l_old_rel.count
        end
    

    For the whole case, following screenshots demonstrate the case

    start of routine execution enter image description here end of routine execution enter image description here

  • Jan 24
    Eiffel: void safety, a concise way to test if an object exists and then call its feature

    I was wondering if there is a clearer statement then

    if not attached foo then
        create foo
    end
    if attached foo as l_foo then
        l_foo.bark
    end
    

    as

    if not attached foo then
        create foo
        foo.bark
    else
        foo.bark
    end
    

    would repeat the foo.bark and obviously I want to avoid it... and even the last statement won't compile with void-safety as foo on else could be void...

  • Jan 24
    Eiffel: a way to ensure db_cursor: DB_RESULT has not moved

    I'm looking for a way to ensure that cursor: detachable DB_RESULT from DB_SELECTION class hasn't moved. I didn't find any method to get access to it. Does the following statement ensure it?

        ensure
            cursor_not_moved: a_db_service.cursor.is_equal(old a_db_service.cursor)
    

    The item method for example doesn't seem to ensure that even if it is only consulting a value of a given row index

  • Jan 13
    Eiffel: Error: variable is not properly set. in make calling default_create or any parent calling/redefining default_create

    Not sure exactly, but it makes various time I got a Error: variable is not properly set. in creation procedures' calling order. I figured out that creating class attributes before calling default_create seemed to solve the problem. Why is that so? It doesn't seem that default_create calls something in my make routine??!!!

    Try to make an example even if I don't think I can reproduce it with a simple example...

    Working

    class A
    
    feature
    
        attr: B
    
        make
            do
                create attr
                default_create
            end
    
    end
    

    Error: variable is not properly set.

    class A
    
    feature
    
        attr: B
    
        make
            do
                default_create
                create attr
            end
    
    end
    
  • Jan 13
    Eiffel: change the signature of a inherited feature

    How is the correct way to change the signature of a feature in Eiffel if any? if there is no option as I understood, how would be the correct way to define in a parent class that there will be a feature to be able to select but still don't know arguments number and types (types are resolvable with polymorphism...)

    Is the only available playing with polymorphism having an argument into class a to select of type ANY?

    class SELECTABLE

    class SELECTABLE
    
        select
            deferred 
            end
    
    end -- class
    

    class DB_SERVICE

    class DB_SERVICE
    
    inherit
        SELECTABLE
            (...)
    
    feature -- Status setting
    
    
        select (a_db_connection: DB_CONNECTION)
            local
                l_qry: STRING
            do
                item := first_item_from_qry (l_qry)
            end
    
    end -- class
    
  • Jan 11
    Eiffel: Error: type is based on unknown class

    Trying to implement some test cases on EWF application with rest web services and JSON objects, I'm gettint a Error: type is based on unknown class. after adding my first class inheriting from EQA_TEST_SET

    Seems pretty complicated to implement test cases for a simple curl -v --header "Content-Type: application/json" --request POST --data '{"id":11,"name":"someName","enumerate":{"id":5}}' http://localhost:9997/someEntity curl command! How can I do that? Where is there some example? I'm trying to copy-paste the example from $ISE_LIBRARY/contrib/library/web/framework/ewf/wsf/tests/src/test_wsf_request.e as a base, but for the moment....

    I can find the class when browsing the dependencies as shown in screenshot, but the compiler not! strange behaviour!

    My app_ewf_app.ecf

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <system xmlns="http://www.eiffel.com/developers/xml/configuration-1-19-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-19-0 http://www.eiffel.com/developers/xml/configuration-1-19-0.xsd" name="sit_ewf_app" uuid="0AB55F0B-014A-4775-B93F-ACC31C9300D5">
        <target name="common" abstract="true">
            <file_rule>
                <exclude>/CVS$</exclude>
                <exclude>/EIFGENs$</exclude>
                <exclude>/\.svn$</exclude>
            </file_rule>
            <option warning="true">
                <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
            </option>
            <capability>
                <catcall_detection support="none"/>
                <concurrency support="scoop"/>
                <void_safety support="all" use="all"/>
            </capability>
            <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
            <library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
            <library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf"/>
            <library name="lexical" location="$ISE_LIBRARY\contrib\library\gobo\library\lexical\library.ecf"/>
            <library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
            <library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc.ecf"/>
            <library name="store" location="$ISE_LIBRARY\library\store\store.ecf"/>
            <library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
            <library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
            <library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf"/>
            <cluster name="database" location=".\database\" recursive="true"/>
            <cluster name="entity" location=".\entity\" recursive="true"/>
            <cluster name="error" location=".\error\" recursive="true"/>
            <cluster name="handler" location=".\handler\" recursive="true"/>
            <cluster name="logger" location=".\logger\" recursive="true"/>
            <cluster name="misc" location=".\misc\" recursive="true"/>
            <cluster name="relationship" location=".\relationship\" recursive="true"/>
            <cluster name="rest" location=".\rest\" recursive="true"/>
            <cluster name="service" location=".\service\" recursive="true"/>
            <cluster name="sit-json" location=".\sit-json\" recursive="true"/>
            <!-- TESTS -->
            <cluster name="tests" location=".\tests\" recursive="true"/>
        </target>
        <target name="ewf_app_any" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <concurrency support="scoop"/>
            </capability>
            <library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>
            <library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>
            <library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="any_launcher" location="$|any\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app_standalone" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <catcall_detection support="none"/>
                <concurrency support="scoop"/>
                <void_safety support="all"/>
            </capability>
            <variable name="httpd_ssl_disabled" value="true"/>
            <library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
            <library name="eel" location="$ISE_LIBRARY\contrib\library\text\encryption\eel\eel.ecf"/>
            <library name="ewsgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\ewsgi\ewsgi.ecf"/>
            <library name="http_client" location="$ISE_LIBRARY\contrib\library\network\http_client\http_client.ecf"/>
            <library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="default_launcher" location="$|default\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app_cgi" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <concurrency support="scoop" use="none"/>
            </capability>
            <library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="default_launcher" location="$|default\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app_libfcgi" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <concurrency support="scoop" use="none"/>
            </capability>
            <library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="default_launcher" location="$|default\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app" extends="ewf_app_any">
        </target>
    </system>
    

    My error

    enter image description here

  • Jan 11
    Eiffel: unknown identifier `cursor` on LINKED_LIST[STRING]

    I have an unknown identifier on the local like some_values.cursor, I really don't understand why!

    qry_update_set_fields (some_keys, some_values, some_unstored_field_names: LINKED_LIST[STRING]): STRING
        require
            same_some_keys_some_values_count: some_keys.count = some_values.count
        local
            l_val_c: like some_values.new_cursor
        do
            Result := ""
            l_val_c := some_values.new_cursor
            across
                some_keys as l_key_c
            loop
                Result := l_key_c.item + "=" + l_val_c.item + ","
                l_val_c.forth
            end
            if Result.ends_with (",") then
                Result.remove_tail (1)
            end
        ensure
            dont_modify_parameters: old some_keys.is_equal (some_keys) and old some_values.is_equal (some_values)
        end
    

    working

    l_val_c: LINKED_LIST_CURSOR [STRING]
    

    Neither working

    l_val_c: LINKED_LIST_CURSOR [like some_values.item]
    
  • Jan 11
    Eiffel: Call use obsolete feature. Call to feature `to_string_8': Use `name_32' instead

    I have a warning I cannot get rid of neither understand:

    Eiffel: Call use obsolete feature. Call to feature `to_string_8': Use 'name_32' instead

    item_prototype is a DB_SERVICE where I redefine out

    if attached {APP_CONFIGURATION}.application_instance.selected_entity_primary_key ({SIT_UTIL}.class_name_lowercase ({like item_prototype})) as l_pk then
    

    enter image description here enter image description here

    One more point is that I wasn't able to copy the warning msg to my clipboard, how do I do that? if there is a way into EiffelStudio.

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

    After stopping an EWF app and starting it again in a Address already in use: c_bind Address already in use: IO_FAILURE raised

    enter image description here

    As explained here, it seems that TCP socket timeout is not available for some time before being released by OS.

  • 2018, Dec 20
    Eiffel library: JSON_OBJECT.item and common method to get content

    If I want to have the content value as string of a JSON_OBJECT.item ("key") without having to

    some_json_value_as_string: STRING
        do
            if attached {JSON_STRING} l_json_o as l_s then
                Result := l_s.unescaped_string_8
            elseif attached {JSON_NUMBER} l_json_o as l_n then
                Result := l_n.item.out
            else
                check
                    you_forgot_to_treat_a_case: False
                end
            end
        end
    

    for a json object like

    {
    |       |       "datasource_name": "DODBC",
    |       |       "datasource_username": "dev_db_usr",
    |       |       "datasource_password": "somePassword",
    |       |       "ewf_listening_port": 9997,
    |       |       "log_file_path": "/var/log/ewf_app.log",
    |       |       "default_selected_company": 1,
    |       |       "default_selected_branch": 1,
    |       |       "default_selected_consumption_sector": 1,
    |       |       "default_selected_measuring_point": 1,
    |       |       "default_selected_charge_unit": -1
    |       }
    

    the {JSON_VALUE}.representation with io.putstring is:

    datasource_username=dev_db_usr
    

    and not the value only!!!

    is there a way to do that? I didn't find intuitive the different methods of JSON_VALUE: values as the out method gives the class and pointer address, which is really far from a string representation of the associated json object for me...

  • 2018, Dec 20
    How do I initialize and fill a linked list in Eiffel?

    Here's what I have so far.

    create {LINKED_LIST[INTEGER]} list.make
    from
        i := 0
        list.start
    until
        i = 11
    loop
        list.put(i)
        i := i + 1
        list.forth
    end
    

    The debugger points to line list.put(i). I think the problem is that list is not properly initialized? I'm having a bit of an issue with figuring out how to use linked_list because I can't find any proper tutorial to help with. As you can see, I am just trying to write a LINKED_LIST program that adds numbers [0,10] in a linked list. Not a school project. Just practicing ahead of an upcoming course. Please help!

  • 2018, Dec 17
    Eiffel: How do I handle timezones?

    I didn't find any notion of timezone DATE_TIME class and TIME class. Am I wrong?

    How do I handle timezones with Eiffel library?

    Is there a way to specify it from the {DATE_TIME}.formated_out ("YYYY-MM-DD [0]hh:[0]mi:[0]ss")

    Is there a setter for timezone?

    I already got this problem with the logger which is logging with UTC...

    The only workaround I found was l.hour_add (-3) before the formated_out which is really dirty

  • 2018, Dec 17
    How to check if file exists in Eiffel
    feature 
    
        open_file_sample
            local
                l_file: UNIX_FILE_INFO
                l_path: STRING
            do
                make
                l_path := "/var/log/syslog"
                l_file.update (l_path)
                if l_file.parent_directory.exists and then l_file.parent_directory.is_writtable then
                    create l_file.make
                end
                 -- AS the above statement doesn't exist!
                check
                    syslog_file_exists_and_is_readable: l_file.exists and then l_file.is_readable
                end
            end
    

    Is this the proper way to check for file existence in Eiffel?

    I was wondering if there is a way not to create 2 objects. I'll complete my check with following statement:

    • define path `l_file_path := "/some/path/with_file.log"
    • check if parent directory exists and has rights to write into
    • create log file
  • 2018, Dec 13
    Eiffel compilation through Makefile and `dpkg-buildpackage -us -uc` generating an error
  • See more ...