Search code examples
eiffel

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?


Solution

  • A parenthesis expression can be used as a target of a qualified call:

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