liberty-eiffel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Liberty-eiffel] Inline agent


From: Cyril ADRIAN
Subject: Re: [Liberty-eiffel] Inline agent
Date: Fri, 19 Feb 2016 10:17:49 +0100

Hi,

There is no right or wrong here. The compiler—and I—just consider best practice to write the open arguments after an agent declaration.

It is always the same trend with SmartEiffel and Liberty Eiffel: be explicit rather than implicit.

It may be slightly overkill for inline agents since it is quite legible as it is; but it is a good check for the non-inline agent declarations as it allows to at least make the number of arguments locally visible, and to ensure that the number of arguments is right.
It could have been worse; the best thing would be to spell out the type of the arguments too (with curly brackets instead of question marks).

Also note that in all cases you will have to add the arguments part if you have closed arguments; in that case, the remaining open arguments still have to be explicitly written.

Anyway, in its current form just add (?) after the closing end of your agent declaration.

Cheers

2016-02-19 10:01 GMT+01:00 Paolo Redaelli <address@hidden>:
I always overlooked this.
My code is full of inline agents like this:

headers.for_each(agent (a_string: ABSTRACT_STRING) do
   .... some stuff...
   std_error.put_string(a_string)
   ...
   end)

And the compiler tells me

****** Warning: Please consider writing an explicit open argument list for your agent creation.

Line 203 column 36 in WRAPPERS_GENERATOR (/home/paolo/current-liberty/src/tools/wrappers-generator/wrappers_generator.e):
                  headers.for_each(agent (a_string: ABSTRACT_STRING)


I perfectly know it's a silly question.... who is right? Me or the compiler?




--
Cyril ADRIAN

reply via email to

[Prev in Thread] Current Thread [Next in Thread]