Forum

  • Aug 19
    Re: [eiffel-users] C++ is losing its grip
    Thanks for the link. It is probably best to avoid the Register, but read read it to correct a lot of guff they put around (and guff in comments). Here is the comment thread. It is interesting that karlkarl has been voted down about 10 to 1. But I also think it would be interesting to provide an
  • Aug 19
    Re: [eiffel-users] Re: C++ is losing its grip
    I've had to write C++ code for many years...and I never had a grip. On Mon, Aug 19, 2019, 11:25 AM Finnian Reilly wrote: > Hi Ian > I think you are being diplomatic with your title. Perhaps what you really > meant is that C++ programmers are loosing their grip (on reality) 😃
  • Aug 19
    Re: C++ is losing its grip
    Hi Ian I think you are being diplomatic with your title. Perhaps what you really meant is that C++ programmers are loosing their grip (on reality) 😃 I didn't feel like signing up to the register just to read the original post, but I found the news from "the horses mouth" i..e on dropboxes own
  • Aug 18
    C++ is losing its grip
    This is a rather interesting article that DropBox is dropping C++ as a cross-platform language. https://forums.theregister.co.uk/forum/1/2019/08/16/dropbox_gives_up_on_sharing_c_code_between_ios_and_android/?post_received=3850154#c_3850154 I put in a long comment in reply to the regular C++
  • Aug 18
    An upcoming graphical application created with Eiffel and the Vision-2 libraries
    Introducing Matyroshka Over the weekend I held a software reveal and digital art exhibition to show of my new Matryoshka software which I hope to release to the general public by the end of the year, or early 2020. I invited various professional artists, graphic designers and illustrators based
  • Aug 18
    RE: [eiffel-users] Re: Returning to Eiffel
    No. -- BM From: eiffel...@googlegroups.com [mailto:eiffel...@googlegroups.com] On Behalf Of Bernd Schoeller Sent: Sunday, 18 August, 2019 01:43 To: eiffel...@googlegroups.com Subject: Re: [eiffel-users] Re: Returning to Eiffel Hello ECMA people ;-) Just a short question concerning
  • Aug 18
    Re: [eiffel-users] Re: Returning to Eiffel
    I don't think this has been discussed. But it does not work anyway because we also want to be able to call this kind of features in regular object calls: c := {COLOR}.red c := my_color.red So, to follow your suggestion, it should have been: Current = Void or Current /= Void
  • Aug 18
    Re: [eiffel-users] Re: Returning to Eiffel
    That's what I had setup too, though with a snafu: the program name is case sensitive in the XML file so at first StepThree did not match stepthree.exe. But still don't see the other presentation I hope to get. I wonder if there is a hidden switch in the WEL package that does not get properly set
  • Aug 17
    Re: [eiffel-users] Re: Returning to Eiffel
    Hello ECMA people ;-) Just a short question concerning this: Had it been discussed to use 'Current = Void' instead of 'class' ? Why was this dismissed? Regards, Bernd On 29/07/2019 06:17, Bertrand Meyer wrote: This is a recent addition. See https://dev.eiffel.com/EiffelStudio_18.01_Releases.
  • Aug 17
    Re: [eiffel-users] Re: Returning to Eiffel
    YOUR_EXE_NAME
  • Aug 17
    Re: [eiffel-users] Re: Returning to Eiffel
    > Windows didn't seem to pick up the manifest, although tailored according > to > https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview , > and dropped side-by-side to the exe, both in workbench mode and in a > finalized version. Still looking for an answer.
  • Aug 16
    Re: [eiffel-users] Re: Returning to Eiffel
    You need the Windows manifest file in the same folder as the EXE. Stupid, I know, but there it is.
  • Aug 16
    Re: Returning to Eiffel
    I created a small window layout in EiffelBuild and generate / compile it. The presentation looks vey different in the run time version than in the develpment presentation. EIffelBuild shows: [image: Main window in EiffelBuild.png] Runtime started out of EiffelStudio (native Windows, not
  • Aug 15
    Re: Newbie question on code reuse - using a previous project
    Thanks for the input, guys. In my case I frequently have several 'experimental' applications, and rarely have a finished 'primary' from which to base the others. I tend to pick the last variant that is closest to my next idea and work from there. I do also have classes that rarely change, and
  • Aug 13
    Re: Newbie question on code reuse - using a previous project
    Management library. Think of it as a library for creating "Swiss-army knife applications". Visit the link for details. You inherit EL_MULTI_APPLICATION_ROOT in your root class. An example of it's use in the root class of project toolkit.ecf: APPLICATION_ROOT Note: currently Eiffel-loop only
  • Aug 13
    Re: Returning to Eiffel
    I guess I have found the relevant discussion to my question at Void-safety: Background, definition, and tools on Eiffel.org.
  • Aug 13
    Re: [eiffel-users] Re: Newbie question on code reuse - using a previous project
    Together with good project organization and the appropriate culling out of classes into small libraries—one also has the notion of project "targets". I have a tool that I built for myself that creates a new project with a minimum of two targets—a primary project target and a test target. What
  • Aug 13
    RE: [eiffel-users] Re: Newbie question on code reuse - using a previous project
    Happens all the time. Well, it happens. First, you should organize your originating project into what is, and isn't reusable. This is always a good exercise and leads to a more robust (read: compulsive) class-oriented/reusable-component mindset, from which you will not likely ever recover. The
  • Aug 13
    Re: Newbie question on code reuse - using a previous project
    Slightly OT (a regular occurrence with me), I often find myself wanting to make a variant of a project, and it would be handy if there was a way to 'copy & rename' a project in a couple of clicks (assuming I haven't missed this option somewhere). At the moment I do this by creating a new project
  • Aug 10
    Re: Newbie question on code reuse - using a previous project
    Hi Hank, As the others have responded, there is a cluster option and a library option. Myself—I tend to the library option, creating many small specialized libraries. I do this in a step-wise fashion—creating a cluster within my project to start and then migrating that cluster out into a
  • Aug 10
    Re: [eiffel-users] Re: Returning to Eiffel
    Is this not why we have SCOOP? On Friday, August 9, 2019 at 2:33:47 PM UTC-4, colinpauladams wrote: > > Probably first_window is an attribute of the class. Then there is the > possibility of multi-threading to take into account (first_window might > become detached on another thread). > > On
  • Aug 10
    Configuration/version management
    The topic of built-in support for configuration management within EiffelStudio comes up regularly. So far the internal view has been that each organization has its own approach to configuration management and that we don’t want to be imposing a particular method or tool. That point was made long
  • Aug 10
    A question about SCOOP and C
    I have been looking through the SCOOP documentation and I couldn't find anything as it relates to making asynchronous calls to C routines via the external keyword. Is it possible? What is the relation of SCOOP to the C world?
  • Aug 09
    Re: [eiffel-users] Re: Returning to Eiffel
    Probably first_window is an attribute of the class. Then there is the possibility of multi-threading to take into account (first_window might become detached on another thread). On Fri, 9 Aug 2019 at 19:20, Richard wrote: > Some words of wisdom, please > > From a
  • Aug 09
    Re: Returning to Eiffel
    Some words of wisdom, please From a VisualEiffel example the main class below with a snippet of interest highlighted in blue. I attempt to replace it by the snippet highlighted in brown. The compiler is cautious on void saftey and marks my code with VUTA(2) (see below). My question: What is
  • Aug 09
    Re: [eiffel-users] Re: Returning to Eiffel
    Hi, Thanks for all the valuable feedback. We'll try to address each of them, especially for the preferences and shortcuts. About eiffel.org, you can contact the Eiffel.org webmaster team using https://www.eiffel.org/contact -- Jocelyn On Fri, Aug 9, 2019 at 1:54 AM Richard
  • Aug 08
    Re: Returning to Eiffel
    Eiffel dot Org - the Community information portal While several sections have a comment function this is not the case for erverything. Question: how do I contact the web host for pointing out discrepancies? Like in the Resources division, the Libraries page at https://www.eiffel.org/resources/l
  • Jul 30
    Re: Returning to Eiffel
    Me Culpa! I should not be posting late night to a mailing list, cannot silently fix like on a forum ;) i Of course my "minimalistic" version has gone too minimalistic by dropping the item that implies the difference of the objects. Different names for the same stuff makes no different objects ;(
  • Jul 30
    Re: Understanding the idea behind explicitly specifying Generic parameters
    Thx Larry, good point! the only thing that annoys me on that case is the refactoring in case I'd like to change the generic constraint of that class which happened to me (and think many of us) anytimes, in that case it becomes more complicated. But yes, using a `like ` reference is helping many
  • Jul 30
    Re: Returning to Eiffel
    For the record and free to steal the suggestion. Based on the prior discussion of the removed unique and with the code snippet supplied by Alexander Kogtenkov as suggested replacement I tinkered and came up with following minimalistic approach. note description: "Minimalistic enumeration class
  • Jul 24
    Eiffel: regular expressions how to do grouping

    I'd like to do grouping of regular expressions with eiffel. How do I do something like

    l_reg.compile ("^([0-9]{3}) (rabbit[0-9]).*")
    l_groups := l_reg.groups ("123 rabbit1")
    my_first_rabbit := l_groups.at (2)
    

    Didn't find any example on groups, LX_DFA_REGULAR_EXPRESSION class and other googlings

  • Jul 23
    Eiffel: how do I do a system call?

    Id like to uncompress a file with bzip2 myFile.bz2 which class do I have to use for that?

    I tried to find it into base kernel documentation which made the most sense for me and didn't find it

  • Jul 19
    Eiffel: percent character into a string

    How do I concatenate a percent % string to a string?

    as either do not work

    s := "%%" + s + "%" 
    

    I know its a special character but don't afford it neither do I find the doc...

    UPDATE

    The answer was one of my attempts, but it could stay an issue of the compiler/editor. After putting the example into the same feature, compiling, and replacing the old code the compiler did not complain anymore, but still stays as syntax coloration strange

    enter image description here

  • Jul 19
    Eiffel: syntax error on multiple Generic constraint

    As per this documentation, I'm trying to constrain a Generic parameter to 2 classes and need a default_create creation procedure call in my implementation.

    I'm getting a Syntax error from compiler on the select clause. Why is that so?

    I thought first that calling default_create will call the G one which could be a merge/renaming/etc. but seems that on that level I have to call either one of both or both renamed which makes sense for me. But why does this syntax fail?

    The context and my code is following:

    deferred class
        IDENTIFIABLE_CASH[G -> {IDENTIFIABLE[ANY],
                                DB_ENTITY select default_create end} create default_create end]
    
    inherit
        DB_SERVICE_CASH[G]
    
    
    feature -- Access
    
        cash_from_identifier (an_identifier: like {IDENTIFIABLE_DB_ENTITY[ANY]}.identifier): G
                -- Returns firt entity found like given an_identifier (like operator is used)
            local
                l_qry: COMPOSED_SQL_QUERY
            do
                across
                    cash is l_item
                loop
                    if l_item.identifier.is_equal(an_identifier) then
                        Result := l_item
                    end
                end
                if not attached Result then
                    create l_qry.make (item_prototype)
                    l_qry.add_constraint (create {FIELD_CONSTRAINT}.make (Void, identifier_db_column_name, {CONSTRAINT}.Like_operator, an_identifier))
                    load_entities (l_qry)
                    if items.count > 0 then
                        Result := items.first
                    else
                        create Result
                        check
                            item_not_found: False
                        end
                    end
    
                    cash.extend (Result)
                end
            end
    
  • Jul 03
    Eiffel: Where can I find a reference with common features lists?

    Am looking for typical

    feature {NONE} -- Initialization (semantic)
    feature -- Status Settings (semantic)
    .....
    

    Where can I find that list with semantic?

    Didn't find it into ECMA

  • Jun 29
    Eiffel: best way to compare types without getting a catcall

    Got a Catcall trying to compare 2 types, how could I do that avoiding passing through another not dedicated method (like to string, class_id or stuff like that)?

    enter image description here

    SIT_UTIL

        class_name_lowercase (a_string: STRING): STRING
                -- a copy lowercased and pruned from preceding '!'
            do
                Result := a_string
                if Result.index_of('!', 1) = 1 then
                    Result := Result.substring (2, Result.count)
                    Result.to_lower
                else
                    Result := Result.as_lower
                end
            ensure
                instance_free: class
            end
    

    CLIENT_CLASS

        relationship_from_secondary_type_equal (a_type: like relationships.item.secondary_type): detachable like relationships.item
                -- Returns first instance of found relationship secondary type which equals given one
            do
                across
                    relationships as l_rel
                until
                    Result /= Void
                loop
    --              if attached (a_type / l_rel.item.secondary_type) then -- Don't want conformance but equality
    
    --              if attached (a_type.is_equal (l_rel.item.secondary_type)) then -- tried but as is_equal needs a like Current => Catcall
    --              if attached (a_type.equal (a_type, l_rel.item.secondary_type)) then -- Catcall because b signature is like a
                    if {SIT_UTIL}.class_name_lowercase (a_type).is_equal({SIT_UTIL}.class_name_lowercase (l_rel.item.secondary_type)) then
                        Result := l_rel.item
                    end
                end
                check
                    not_found_relationship: Result /= Void
                end
            end
    
  • Jun 29
    Eiffel: a way to check type conformance with a given CLASS_NAME

    I'm trying to do something as

    work (a_father: FATHER)
        do
            if a_father.conforms_to ({DEVELOPER}) then
               a_father.code
            else
               a_father.change_job ({DEVELOPER})
            end
        end
    

    enter image description here enter image description here

    the compilation works, but in my implementation @runtime it doesn't pass. What did I mistype?

  • Jun 29
    Eiffel, multiple types conformance: a way to specify that a parameter is a descendent from A and B?

    Is there a way (I'm sure there is out of runtime check...) to specify that a parameter or a variable in general conforms to multiple types? to avoid doing something such as

    work (a_printer: PRINTER; a_scanner: SCANNER)
        do
          a_printer.print
          a_scanner.scan
            -- OR without second parameter
          if attached {SCANNER} a_printer as l_scanner then
             l_scanner.scan
          else
             throw RuntimeError
          end
        end
    
  • 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

  • See more ...