Local variables [1] exist (at least) since ALGOL 60 (1960) [2] (that's part of "magic" that makes recursive functions feasible). Programming languages Pascal (1970) and C (~1972) also has local variables (any non-static variable declared inside a block). Most likely, Eiffel (~1985) and bash (1989) simply explicitly give the proper name to that kind of variables.
--
Eiffel (IMHO) [still] is quite unique in the application of the
uniform access principle to argumentless-functions/attributes.
-miguel
[1] Execution stack stored variables.
[2] https://en.wikipedia.org/wiki/ALGOL_60 , https://www.algol60.org
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/eiffel-users/76eabd7e-ae35-419c-a60e-49ac420037b1n%40googlegroups.com.
-- Miguel Oliveira e Silva IEETA-DETI, University of Aveiro, Portugal
To be precise in Eiffel “optional () on function call” is not quite right. If there are no arguments there is no “()” part. The full formal argument list in parentheses simply does not appear.
The relevant syntax production is Entity_declaration_list == {Entity_declaration_group ";" …}+
(A Formal_arguments part is defined as "(" Entity_declarations ")" .)
This convention ensures uniform access (parentheses would be meaningless for an attribute).
-- BM
To view this discussion visit https://groups.google.com/d/msgid/eiffel-users/9311b4f1-e860-4087-ba41-413175a7ef6b%40ua.pt.
On 14 Feb 2025, at 22:02, Finnian Reilly <frei...@gmail.com> wrote:
I just noticed that Bash script and Eiffel have two syntactic similarities.
- Use of local reserved word
- optional () on function call
<bash.png>
Is that a coincidence I wonder ?
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/eiffel-users/76eabd7e-ae35-419c-a60e-49ac420037b1n%40googlegroups.com.
<bash.png>
That's not correct about return: You can return an integer (status code),
but in most cases it's interpreted as Boolean failure code (as the C library functions do).
if you are referring to conditional statement like if then then it is not true to say the return value is interpreted as a boolean otherwise success would be 1 and failure would be 0.
The code is wrong:
check_root() {
[[ "$EUID" -eq 0 ]] && exit 0 || exit 1
}
Correct is:
check_root() {
[[ "$EUID" -eq 0 ]]
}
Thanks for pointing out the mistake of Chat GPT, and it did look a little strange to me. This shows why you cannot rely on Chat GPT for coding. Our programming careers are safe for the time being. :-)
Please learn about $?.