Forum

  • Oct 19
    Re: Dealing with generic parameters of a class
    As I may still be wrong with my design, Alexander gave an answer to this case if there's somebody else which needs it... https://stackoverflow.com/a/52898300/2118777 On Friday, October 19, 2018 at 3:52:04 PM UTC-3, Gachoud Philippe wrote: > > What I'd like to do is to set the router of a EWF in a
  • Oct 19
    Re: [eiffel-users] Dealing with generic parameters of a class
    No. On Fri, 19 Oct 2018 at 19:29 Gachoud Philippe wrote: > As described here, I was wondering if there is such a mechanism and why > can't I do something like G.bark if G -> DOG > > Is there a way to check on given Generic parameter of a Class without any > attached instance
  • Oct 19
    Re: Eiffel Reporting Library
    Looks like a big (and important) project. regards Williams On Friday, October 19, 2018 at 2:39:01 PM UTC-3, Larry Rix wrote: > > Hi All, > > I tried to resurrect the epdf library, but to no avail. There is just too > much I do not understand. So—I decided that I still wanted an easy way to >
  • Oct 19
    Re: Dealing with generic parameters of a class
    As probably many others here will say, it looks like you have a bad design. regards Williams On Friday, October 19, 2018 at 3:29:17 PM UTC-3, Gachoud Philippe wrote: > > As described here, I was wondering if there is such a mechanism and why > can't I do something like G.bark if G -> DOG > > Is
  • Oct 19
    Eiffel: Is there a way to test a given Generic parameter of a Class without any attached instance of it?

    Is there a way to test a given Generic parameter of a Class without any attached instance of it?

    class BAG[G -> MOUSE]
    
    feature -- 
    
        discriminate
            do
                if G.conforms_to (MAMMAL) then
                    io.putstring ("you gave me a real animal")
                elseif G.conforms_to (COMPUTER_ACCESSORY) then
                    io.putstring ("Seems you don't like animals such as computers")
                else
                    io.pustring ("Still dont know what you are dealing with")
                end
            end
    
  • Oct 19
    Re: Dealing with generic parameters of a class
    On Friday, October 19, 2018 at 3:29:17 PM UTC-3, Gachoud Philippe wrote: > > As described here, I was wondering if there is such a mechanism and why > can't I do something like G.bark if G -> DOG > > Is there a way to check on given Generic parameter of a Class without any > attached instance of
  • Oct 19
    Dealing with generic parameters of a class
    As described here, I was wondering if there is such a mechanism and why can't I do something like G.bark if G -> DOG Is there a way to check on given Generic parameter of a Class without any attached instance of it? class BAG[G -> MOUSE] feature -- discriminate do if
  • Oct 19
    Re: Dealing with generic parameters of a class
    What I'd like to do is to set the router of a EWF in a class that depending on the handler will set the router in a different way.... try to be more clear even if I'm maybe wrong with my design class SOME_WSF_RESOURCE_HANDLER[G -> PARENT] inherit WSF_RESOURCE_HANDLER_HELPER feature
  • Oct 19
    Re: [eiffel-users] Eiffel Reporting Library
    I cannot say enough about the lack of complex dependencies! Just about every other reporting solution I could find came with a whole host of complex dependencies. Folks might be mesmerized by "stacks" of technologies, which might make people feel "special" because they understand how to
  • Oct 19
    Eiffel Reporting Library
    Hi All, I tried to resurrect the epdf library, but to no avail. There is just too much I do not understand. So—I decided that I still wanted an easy way to create pretty-reports in Eiffel using a common output target of PDF. The new library I have on github and at iron is a few steps in that
  • Oct 19
    Eiffel EWF Application standalone C Bind Error

    After starting it with F5, it seems that when I stop an EWF application (from estudio stop button) it takes up to 10 seconds to free the defined port on linux debian machine, Don't know if its only on this OS but is there a way to make it stop quicker? I always have to wait for some seconds to start it again after some corrections. enter image description here

  • Oct 18
    Eiffel: EWF_APP_EXECUTION (EWF application) exit function

    As there is an initialize function, is there an exit/on_exit function such as I can close my database connection into it?

  • Oct 18
    Re: [eiffel-users] Welcome Melissa
    YAY! Welcome to the group
  • Oct 18
    Welcome Melissa
    Good morning guys, this is Melissa, the newest member of Eiffel community! [image: Melissa_01.jpg] regards Williams
  • Oct 18
    Re: [eiffel-users] Welcome Melissa
    My son likes to do Eiffel programming on my knees in front of my computer. But he's already an old guy: 16 months! :-) Congratulations. -- Eric Bezault mailto:er...@gobosoft.com http://www.gobosoft.com
  • Oct 18
    Eiffel: is there a way to print colorized characters into a terminal (console)

    Trying to write some logger enhancements I'd like to deal with ANSI codes interpretation, and it seems that it's not working with the standard io.putstring method neither with print I wonder there is a way to do something such as

    echo -e "\u001B[31mSome_red_txt" in bash

    Seems other languages can do it but I can't in Eiffel.

  • Oct 17
    Eiffel: once function has generic or anchored result. Trying to create constants

    I'm trying to create some terminal logging colors to be able to see clearer my errors. Doing that it seems to me obvious that I'd have to create constants like followings. As I don't want to create an instance each time I call my constant, it makes sense for me to do something like that, but the compiler doesn't seem to have the same conception as me...

    A once function has generic or anchored result what is an anchored result?

    As the compiler has always the last word and me the forelast, why am I wrong and is he right??

    class
        TERMINAL_COLOR
    
    create
        make
    
    feature -- Initialization
    
        make (a_fg: like foreground; a_bg: like background)
            do
                foregound := a_fg
                background := a_bg
            end
    
    feature -- Status report
    
        foreground: INTEGER
    
        background: INTEGER
    
    feature -- Colors
    
        Black: like Current
            once -- compiler doesn't agree with me
                create Result.make (30, 40)
            ensure
                instance_free: class
            end
    
    end
    
  • Oct 17
    Eiffel: how do I create and use an UTIL class, or "call static method from class"

    as my post describes it, I'd like to create an UTIL class with a never_both function.

    class
        UTIL
    
    create
        default_create
    
    feature -- could be in class BOOLEAN
    
        double_implies, reversible_implies, never_both (a, b: BOOLEAN): BOOLEAN
                -- Into boolean class with never_with
            do
                if a and b then
                    Result := False
                else
                    Result := True
                end
            end
    
    end
    

    When I use it

    invariant
        never_both: {UTIL}.never_both (attached last_error, attached last_success_message)
    

    the compiler complains about a VUNO error

    never_both used in the non-object call is not a class feature.

    I saw 2 notations about objects creating - {UTIL}.never_both (a, b) - ({UTIL}).never_both (a, b)

    Whats the difference between them?

    How to create an application wide (could be even world wide once if you want!) object for the use of this UTIL if possible in Eiffel?!

    I know this is a TUPLE of questions so I put them in Bold

  • Oct 17
    Alias and multiple names for attributes

    Defining various names for a same feature seems possible in Eiffel, what for the attributes?

    Is it possible to name an attribute like:

    background, bk: COLOR
    foreground, fg: COLOR
    

    If not why?

  • Oct 16
    Re: [eiffel-users] Safe-lib Revival
    The error I am getting is below. C:\Users\LJR19\Documents\GitHub\safe-lib\kernel\external\EIFGENs\test\W_code>nmake >> -s -nologo -e ISE_EIFFEL="C:\Program Files\Eiffel Software\EiffelStudio >> 18.07 GPL" -f >> "C:\Users\LJR19\Documents\GitHub\safe-lib\kernel\external\src\spec\ise\windows\makefi
  • Oct 16
    Safe-lib Revival
    Hi All, I would like to see if I can bring the safe-lib set of Eiffel projects back to life (update them from Eiffel Studio 5.2/5.3 to 18.07 and beyond). I am starting with the kernel library because after studying the xace files, this seems the logical place to begin. I have a almost compiling
  • Oct 15
    [eiffel.org] A String Editing Class
    Introducing Class EL_STRING_EDITOR I have added a new class EL_STRING_EDITOR to Eiffel-Loop that is very useful when you want to edit the contents of a string between all occurrences of a pair of delimiters. A typical application is editing the text between markup tags. The beauty of this
  • Oct 14
    Re: [eiffel-users] Switch statement with Void safety / type casting checks
    Dear Philippe, if you decide to use a conditional of the following form local l_pet: ANIMAL do l_pet := catch_it_from_the_sky if attached {MAMMAL} l_pet as al_mammal then l_mammal.express_yourself elseif attached {DOG} l_pet as al_dog then
  • Oct 13
    Re: [eiffel-users] Switch statement with Void safety / type casting checks
    Perfect thank you... On Fri, Oct 12, 2018 at 4:37 PM wrote: > Each 'when' case needs to be a constant value. The dynamic type of an > object is not a constant value, so inspect is not the right mechanism to > use. > > Each object makes available its 'generating_type', and
  • Oct 13
    Re: [eiffel-users] why is deferred feature not made effective?
    That's ok with me. Larry Rix schrieb am Fr., 12. Okt. 2018, 22:14: > Turns out my chore was rescheduled for this evening, so it might be > tomorrow. > > -- > You received this message because you are subscribed to the Google Groups > "Eiffel Users" group. > To
  • Oct 12
    Re: [eiffel-users] why is deferred feature not made effective?
    Turns out my chore was rescheduled for this evening, so it might be tomorrow.
  • Oct 12
    Eiffel ODBC how to get answer from database

    I'm trying to get an answer from ODBC postgresql database when doing a simple

    DELETE * from some_table

    with following code, I'm unable to get the DELETE 1 classical answer? affected_row_count was my guess but seems its not is_affected_row_count_supported. I have the same problem with inserts...

    delete_entity (a_primary_key: INTEGER_64)
            -- Delete from given primary_key object
        require
            valid_db_connection: attached db_connection.base_update
                        and attached db_connection.session_control
        local
            l_void: like item
        do
            if attached db_connection.base_update as l_base_update
                    and then attached db_connection.session_control as l_session_control then
                l_base_update.modify (delete_from_primary_key_query(a_primary_key))
                if l_base_update.is_ok then
                    last_success_message := "Entity with ID " + a_primary_key.out + " deleted from DB successfully"
                    if l_base_update.is_affected_row_count_supported then
                        check
                            only_one_affected_row: l_base_update.affected_row_count = 1
                        end
                        if attached last_success_message as l then
                            l.append (" affected rows:" + l_base_update.affected_row_count.out )
                        end
                    end
                    if attached last_success_message as l then logger.write_information (l) end
                else
                    create {INSERT_ERROR} last_error.make ("last delete did not work: " + l_base_update.error_message_32)
                end
            end
        end
    
  • Oct 12
    RE: [eiffel-users] Switch statement with Void safety / type casting checks
    Each 'when' case needs to be a constant value. The dynamic type of an object is not a constant value, so inspect is not the right mechanism to use. Each object makes available its 'generating_type', and that is of type TYPE. Within the TYPE class is an integer 'type_id'. While that could be
  • Oct 12
    Re: [eiffel-users] Switch statement with Void safety / type casting checks
    Hi Gachould, It is a bit difficult (for me) to discuss this using abstract situations. I suggest that we (you) create a project on GitHub where we could work in a 'real' case and then experiment with the different situations and explore the language through actual examples. I think it will be much
  • Oct 12
    Re: [eiffel-users] Switch statement with Void safety / type casting checks
    On Fri, Oct 12, 2018 at 4:23 PM williams Lima wrote: > Hi Gachould, > It is a bit difficult (for me) to discuss this using abstract situations. > I suggest that we (you) create a project on GitHub where we could work > in a 'real' case and then experiment with the different
  • Oct 12
    Re: [eiffel-users] Switch statement with Void safety / type casting checks
    On Fri, Oct 12, 2018 at 2:35 PM williams Lima wrote: > Hi Gachould, > I don't understand you point about the number of times 'l_pet' is written > using 'inspect' in comparison > with 'if's. In the example above it is written three times (once per > 'when') > you're right in
  • Oct 12
    Switch statement with Void safety / type casting checks
    As mentionned here, I still don't understand the reason of not having a structure such as being able to do: local l_pet: ANIMAL do l_pet := catch_it_from_the_sky inspect l_pet when attached {DOG} l_pet as l_dog l_dog.eat (meat) when
  • Oct 12
    Eiffel: Unknown identifier on attached check into require statement
        require
            valid_item: attached item as l_i and then l_i.valid_for_insert or l_i.valid_for_update
    

    why do I have an unknown identifier here with l_i??!!!

  • Oct 12
    Re: [eiffel-users] Switch statement with Void safety / type casting checks
    Hi Gachould, I don't understand you point about the number of times 'l_pet' is written using 'inspect' in comparison with 'if's. In the example above it is written three times (once per 'when') By the way I think you are not using the 'inspect' construction properly. regards Williams On Fri, Oct
  • Oct 12
    Eiffel: classical typecasting switch structure with attached and inspect

    What is the best practice to do something such as

    local
        l_pet: ANIMAL
    do
        l_pet := catch_it_from_the_sky
        inspect l_pet
        when attached {DOG} l_pet as l_dog
            l_dog.eat (meat)
        when attached {FISH} l_pet as l_fish
            l_fish.eat (plants)
        else
            io.put_string ("Strange animal how do I feed him???")
        end
    do
    

    the compiler is complaining with the attached after when...

    Update: why such a need?

    because it just happened me to mess up with repeated copy-paste which is what a language tries to help avoiding. In the above case, the l_pet is written one time, with a N times if/else I'd have to write it as much times as ifs...

  • Oct 12
    Eiffel: is there a way to express a double implies clause in eiffel?

    Like double bind in psychology, is there a way to tell that one expression implies another and reversely?

    valid_last_error: attached last_error implies not attached last_success_message
    valid_last_success_message: attached last_success_message implies not attached last_error
    

    would be something like

    valid_last_error: attached last_error double_binded_not attached last_success_message
    

    which could be equivalent to

    valid_last_error: attached last_error never_with attached last_success_message
    
    • T stands for True boolean expression
    • F for False
    • R for Result

    implies (a, b: BOOLEAN): BOOLEAN

    a b R
    T T T
    T F F
    F T T
    F F T
    

    and (a, b: BOOLEAN): BOOLEAN

    a b R
    T T T
    T F F
    F T F
    F F F
    

    or (a, b: BOOLEAN): BOOLEAN

    a b R
    T T T
    T F T
    F T T
    F F F
    

    xor (a, b: BOOLEAN): BOOLEAN

    a b R
    T T F
    T F T
    F T T
    F F F
    

    double_implies (a, b: BOOLEAN): BOOLEAN

    a b R
    T T F
    T F T
    F T T
    F F T
    

    as a maybe more explaining example (more known) instead of writing

    invalid_index_implies_off: index < 1 implies off
    off_implies_invalid_index: off implies index < 1
    

    we could write:

    index_coherent_with_off: index < 1 never_both off
    

    which would just add a function to BOOLEAN class such as

    alias never_with, alias reversible_implies (v: like Current): like Current
        do
            if Current and v then
                Result := False
            else
                Result := True
            end
        end
    

    Hope now everybody got my point... I don't know if there is such arithmetic operator.

    We could extend it for a variable number of parameters

  • Oct 11
    Eiffel: escaping characters

    I'm looking for escaping characters for a DB query. As it is a complex mechanism (and also could be hacked), it seems obvious I don't want to rewrite it...

    I saw that in the JSON_STRING class there is something for escaping STRING_8 (unescape_to_string_8) is there something comparable for DB Strings (need for postgresql)?

  • Oct 11
    Eiffel: Is there a way to specify various types for a parameter

    Is there a way to restrict the conformance of a type to be a collection of types?

    Let me explain by example:

    give_foo (garbage: ANY): STRING
        do
            if attached {STRING} garbage as l_s then
                Result := l_s
            elseif attached {INTEGER} garbage as l_int then
                Result := l_int.out
            elseif attached {JSON_OBJECT} garbage as l_int then
                Result := l_int.representation
            elseif attached {RABBIT} garbage as l_animal then
                Result := l_animal.name + l_animal.color
            else
                Result := ""
                check
                    unchecked_type_that_compiler_should_be_able_to_check_for_me: False
                end
            end
        end
    

    Couldn't I do something like (like a convert function could do)

    give_foo (garbage: {STRING, INTEGER, JSON_OBJECT, RABBIT}): STRING
        do
            if attached {STRING} garbage as l_s then
                Result := l_s
            elseif attached {INTEGER} garbage as l_int then
                Result := l_int.out
            elseif attached {JSON_OBJECT} garbage as l_int then
                Result := l_int.representation
            elseif attached {RABBIT} garbage as l_animal then
                Result := l_animal.name + l_animal.color
            else
                Result := ""
                check
                    unchecked_type_that_compiler_should_be_able_to_check_for_me: False
                end
            end
        end
    

    or something like

    not_garbage_hash_table: HASH_TABLE[{INTEGER, STRING, ANIMAL}, STRING]
    
  • Oct 11
    Cannot create EWF application
  • Oct 10
    Eiffel: a way to evaluate a STRING expression like `eval`

    Is there a way to evaluate a STRING expression in Eiffel? (A big source of error I know... but a powerful mechanism!)

    Looking for a way to do a generic setting mechanism for database fields and classes I'm trying to do something like.

    fields_mapping: HASH_TABLE [ANY, STRING]
        do
            create Result.make (10)
            Result.put (name, "name")
            Result.put (surname, "surname")
            ...
        end
    
    set_fields
        do
            across
                fields_mapping as field
            loop
                eval("set_" + field.key + "(" + field.item + ")")
            end
        end
    

    I know I could do it with agents, but it seems for me less generic as I have to define every function 2 times

    • in the fields_mapping
    • in another fields_mapping I have for JSON conversion
  • Oct 10
    Eiffel: like Precursor

    Maybe I'm going to far, but Eiffel is such a beauty that I'd like to be able to say like precursor for Result class of function

    My point is

    deferred class A
        give_me_foo: STRING
        deferred
        end
    end -- class
    
    class real_foo
        give_me_foo: like Precursor
            do
            end
    end -- class
    

    Would be nice, does it exist?

    Update: I let a wish on Eiffel site here

  • Oct 10
    Eiffel: local declaration in or and and failed to compile

    The compiler is complaining about an unknown identifier, seems that it does not recognize any of my multiple declarations, where am I wrong?

    if attached {INTEGER_REF} field.item as l_int
            or attached {INTEGER_64} field.item as l_int
            or ( attached {TUPLE} field.item as l_tuple and then attached {INTEGER_64} l_tuple.item (1) as l_int ) then
        Result.put_integer (l_int.to_integer_64, primary_key_db_column_name)
    elseif attached {STRING} field.item as l_s then
        Result.put_string (l_s, primary_key_db_column_name)
    end
    

    enter image description here

    Update

    As this seems a valid expression I thought that if in every branch of my or a l_int is declared I should be able to use it in the then scope.

    But it seems that this expression is valid

    if attached a.b as l_b and then attached l_b.c as l_c then
        l_c.is_available_in_this_scope
        l_b.is_available_in_this_scope
    else
        io.putstring ("you are wrong dear and either l_b and l_c are not available!")
    end
    

    While this one not!

    if attached a.b as l_b and then attached l_b.c as l_c
            or attached a.x as l_b and then attached l_x.d as l_c then
        l_c.is_available_in_this_scope -- Compiler complain about l_c
        l_b.is_available_in_this_scope -- Compiler complain about l_b
    else
        io.putstring ("you are wrong dear and either l_b and l_c are not available!")
    end
    

    With my code

    This compiles

        if attached {INTEGER_REF} field.item as l_int then
            Result.put_integer (l_int.to_integer_64, primary_key_db_column_name)
        elseif attached {INTEGER_64} field.item as l_int then
            Result.put_integer (l_int, primary_key_db_column_name)
        elseif attached {TUPLE} field.item as l_tuple and then attached {INTEGER_64} l_tuple.item (1) as l_int then
            Result.put_integer (l_int, primary_key_db_column_name)
        elseif attached {STRING} field.item as l_s then
            Result.put_string (l_s, primary_key_db_column_name)
        else
            logger.write_error ("to_json-> Type not found in matching:" + field.item.out)
            check
                not_found_item_type: False
            end
        end
    

    While this not

    if attached {INTEGER_REF} field.item as l_int then
        Result.put_integer (l_int.to_integer_64, primary_key_db_column_name)
    elseif attached {INTEGER_64} field.item as l_int
            or attached {TUPLE} field.item as l_tuple and then attached {INTEGER_64} l_tuple.item (1) as l_int then
        Result.put_integer (l_int, primary_key_db_column_name) -- Unknown identifier `l_int`
    elseif attached {STRING} field.item as l_s then
        Result.put_string (l_s, primary_key_db_column_name)
    else
        logger.write_error ("to_json-> Type not found in matching:" + field.item.out)
        check
            not_found_item_type: False
        end
    end
    
  • Oct 08
    Eiffel: red, green, blue, foo, bar: INTEGER is unique

    I remembered that I was able to do something like

    red, green, blue, foo, bar: INTEGER is unique

    in Eiffel, is it obsolete? for what reason? What does replace it?

  • Oct 01
    Eiffel studio whats the shortest way to put a breakpoint on current line I'm editing

    In Eiffel studio it seems like in the editor basic text view there is no possibility to add a breakpoint.

    The only way I found to add a breakpoint on a line I'm editing is

    1. change to flat view
    2. Scroll again to my function because the scroll went anywhere
    3. Put my break point

    This behaviour makes me loose a lot of time when I'd like to debug something, maybe anybody has a better way....

    Whats the shortest way to put a breakpoint on current line I'm editing

  • Oct 01
    Eiffel: introspection's documentation and caller class

    Where can I find documentation about Eiffel introspection?

    Some functions can be called in the GENERAL Class

    I'm looking for the caller's class name to modify the logger's formatter

    Something like:

    Current.generator_client_object.class_name
    
  • Oct 01
    Eiffel - Two dimensional array

    Is there a special class for a two-dimensional array in Eiffel? Now I do it like this, but I think there is an easier way.
    columns: ARRAYED_LIST [ARRAYED_LIST [CHARACTER]]

  • Sep 29
    Eiffel: How to wipe_out an ARRAY object without recreating it

    Trying to do something like

    a: ARRAY[STRING]
    
    create a.make_empty
    a.put("foo foo fool")
    a.wipe_out
    

    Do I have to? or is there another way as STRING doesn't seem to have a .has_default

    create a.make_empty
    a.put("foo foo fool")
    create a.make_empty
    

    compilation error

  • Sep 28
    Eiffel: Best practices with getters return Void if object not found?

    What is the best practice in Eiffel to return an object from a function if not found. I saw that many collection like ARRAY for example base the not found behaviour on precondition for example or other function.

    Many languages base their politics returning Void (or null) when an object hasn't been found. In Eiffel that would imply to have a detachable object as result?

    Null politic

    item_at_index (index: INTEGER): detachable FOO
        do
            if bar_collection.valid_index(i) then
                Result := bar_collection.item_at(i)
            else
                Result := Void 
            end
        end
    

    Never null politic

    item_at_index (index: INTEGER): detachable FOO
        require
            bar_collection.valid_index(i)
        do
            Result := bar_collection.item_at(i)
        end
    
  • Sep 28
    Eiffel: compilation error `Source of assignment is not compatible with target`

    With complete void check set in compiler I've got a Variable is not properly set compilation error on following case which for me is right (in my mind). It says that the source of assignment is not compatible with target. What am I missing here??? (DB_SERVICE.load_from_primary_key...)

    enter image description here

    Class DB_SERVICE

    deferred class
        DB_SERVICE [G -> DB_ENTITY create make_from_db_result end]
    
    inherit
        ACTION
            redefine
                start,
                execute
            end
    
        LOGGABLE
            rename
                make as make_from_loggable
            end
    
    feature -- Creation
    
        make (a_db_connection: attached DB_CONNECTION)
            require
                valid_db_connection: a_db_connection.is_connected
            do
                make_from_loggable
                db_connection := a_db_connection
                create last_items.make (100)
                create last_column_names.make_empty
            ensure
                db_connection_setted: a_db_connection = db_connection and db_connection.is_connected
            end
    
    feature -- Access
    
        item: detachable G
    
        db_connection: DB_CONNECTION
    
        last_items: HASH_TABLE[like item, INTEGER] -- content of last resultset
    
        last_column_names: ARRAY[STRING] -- Column names of last resultset
    
    feature -- status_report
    
    
        load_from_primary_key (primary_key: INTEGER)
                -- Loads given item into item otherwise item will be Void
            require
                attached db_connection.base_selection
            local
                l_db_result: DB_RESULT
            do
                if attached db_connection.base_selection as bs then
                    bs.query ("SELECT * FROM " + ({attached like item}).out + " WHERE " + {attached like item}.Primary_key_db_column_name + "=" + primary_key.out)
                    if bs.is_ok then
                        bs.load_result
                        create item.make_from_db_result(last_column_names, bs.cursor)
                    else
                        item := Void --HERE is the compiler complaining!
                        logger.write_critical ("Error while retreiving " + ({like item}).out + " from DB")
                    end
                else
                    item := Void 
                    logger.write_error ("base_selection is void")
                end
            end
    
    
    end -- class
    

    Class COMPANY_SERVICE

    class
        COMPANY_SERVICE
    
    inherit
        DB_SERVICE[COMPANY]
            redefine
                make
            end
    ...
    

    Class COMPANY

    class
        COMPANY
    
    inherit
        DB_ENTITY
            rename
                primary_key as id,
                set_primary_key as set_id,
                Primary_key_db_column_name as Id_db_column_name
            redefine
                make,
                make_from_db_result,
                out
            end
    
    create
        make,
        make_from_db_result
    
    ....
    
  • Sep 26
    Eiffel: Creator instruction applies to target of a deferred type

    Class A

    deferred Class A
    
    feature -- 
    
        item: X -- X is deferred
    
        set_item_for_some_reason (param: N)
            do
                create item.make_from_param (param)
            end
    
    end -- class
    

    Class B

    Class B inherit
    
        A
    
    feature -- 
    
        item: Y -- Y not deferred inherits from X
    
    end -- class
    

    I'd like to create in the same class an attribute which will be defined in the descendent and get a Creator instruction applies to target of a deferred type Error which makes sens in a way of reduced context, but not in the context I intend it to do it.

    For me it does make sense to be able to create an object in current deferred class, I wont have to implement in all the descendants! which will be a wrong design... something like this:

    deferred Class A
    
    feature -- 
    
        item: X -- X is deferred
    
        set_item_for_some_reason (param: N)
            do
                set_item_from_param (param)
            end
    
        set_item_from_param (param: N)
            deferred
            end
    
    end -- class
    
    
    Class B inherit
    
        A
    
    feature -- 
    
        item: Y -- Y not deferred
    
    
        set_item_from_param(param: N)
            do
                create item.make_from_param (param)
            end
    
    end -- class
    

    Am I wrong with my design or is it a restriction which is still discussed about Eiffel compiler as I understood? and if yes, what would be the best practice workaround?

  • Sep 26
    Eiffel: How to get class of a Void object? is it possible?

    I have a void object which I declared, but want to get its class name is it possible??

    item: DB_ENTITY
    
    db_connection.base_selection.query("SELECT * FROM " + item.generating_type.out)
    

    Creating it is not what I want...

  • Sep 24
    Can I rely to ISE Eiffel as a programming language to offer web services through a DB connection [closed]

    I'm actually working for a little company of 10 people on the area of solar panels solutions in Chile. Am working on linux since 20 years now. When I studied programing I studied a lot with Eiffel which I found really a great language. Since, I'm frustrated from a language to another missing a lot of great concepts it offers like

    • real object (no string != String; ...)
    • multi-inheritance
    • polymorphism
    • genericity
    • contract.

    Working now with Java because

    • its mostly free
    • the community for tutorials and helps is huge
    • its multi-platform

    I'm looking for the pros & cons to convince the instances of my hierarchy (basically talking about justifying the price of the licences which are 1500$=>1y and 2000$=>2y) and to be a bit secured that I don't pretend I'll go with a solution I'll regret at term because it will be hard to get the support I need to get my solutions working. Is ISE Eiffel reliable for production use? Will I have to get hours of pain making work a solution?

    What are the pros & cons?

    Pros

    • Concepts helping me to write real good quality code (multi-inheritance, polymorphism, genericity, contract)
    • Pleasure to develop with such good tools
    • Quality and reliability of produced code
    • ...

    Cons

    • Poor community, meaning few tutorials
    • I'm not good in C so digging into the implementation of C libraries is something which will cost me (and to the company)
    • Price is high and has to be justified
    • My Curriculum will not be as well as if I have years of experience in Java
    • Formation of other programmers won't be easy if as most of them dont know these concepts
    • ...
  • Sep 23
    Eiffel 18.07 trying to get an ODBC connection running from examples

    Trying to just compile Eiffel_18.07/examples/store/esql/ on Debian 9 I've got following error:

    In file included from od243.c:202:0,
                     from big_file_C8_c.c:42:
    /opt/Eiffel_18.07/library/store/dbms/rdbms/odbc/Clib/odbc.h:27:17: fatal error: sql.h: No such file or directory
     #include <sql.h>
                     ^
    compilation terminated.
    Makefile:36: recipe for target 'big_file_C8_c.o' failed
    make[1]: *** [big_file_C8_c.o] Error 1
    Makefile:72: recipe for target 'C8/Cobj8.o' failed
    make: *** [C8/Cobj8.o] Error 2
    make: *** Waiting for unfinished jobs....
    

    an apt-get install unixodbc unixodbc-dev odbc-postgresql got me further to

    gcc: error: /opt/Eiffel_18.07/library/store/spec/linux-x86-64/lib/libodbc.a: No such file or directory
    Makefile:177: recipe for target 'esql' failed
    

    When I try to go to /opt/Eiffel_18.07/library/store/dbms/rdbms/odbc/Clib thinking I'll be able to generate some code to get it working following the /opt/Eiffel_18.07/library/store/install into /opt/Eiffel_18.07/library/store/dbms/rdbms/odbc/Clib trying a sudo /opt/Eiffel_18.07/studio/spec/linux-x86-64/bin/finish_freezing -library got

    cp: cannot stat '/usr/include/eiffelstudio-18.07/config.sh': No such file or directory
    Can't find config.sh.
    Makefile.SH: 6: .: Can't open ./config.sh
    

    Being a fan of Eiffel, it doesn't seem to be working out of the box and I didn't find enough documentation to get it working :-()

  • Sep 23
    Why current and "old" value of the same expression in a postcondition are equal?

    I'm trying to get the value of an entry in a 2D-array before the implementation and afterwards. But the following postcondition is failing because the 2 entries are somehow the same (and yes, I have redefined is_equal, so that ~ will be object equality):

        ensure
            designated_cell_changed:
                get_entry (row + 1, column + 1) /~ old get_entry (row + 1, column + 1)
    

    Why do I get a postcondition violation designated_cell_changed?

  • Sep 21
    Maximum of 2 INTEGERS?

    What's the syntax for the maximum of 2 INTEGERS?

    Eiffel documentation is so bad, literally could not find the answer to this simple question anywhere!

    Or does it not exist and I have to use if-statements?

  • See more ...