Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Parameter (computer programming)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Alternative convention in Eiffel=== Within the [[Eiffel (programming language)|Eiffel]] software development method and language, the terms ''argument'' and ''parameter'' have distinct uses established by convention. The term ''argument'' is used exclusively in reference to a routine's inputs,<ref>Meyer, Bertrand. ''[[Object-Oriented Software Construction]], 2nd Edition,'' Prentice Hall, 1997, p 444.</ref> and the term ''parameter'' is used exclusively in type parameterization for [[Generic programming|generic classes]].<ref>Meyer, p. 96.</ref> Consider the following routine definition: <syntaxhighlight lang="eiffel"> sum (addend1: INTEGER; addend2: INTEGER): INTEGER do Result := addend1 + addend2 end </syntaxhighlight> The routine <code>sum</code> takes two arguments <code>addend1</code> and <code>addend2</code>, which are called the routine's '''formal arguments'''. A call to <code>sum</code> specifies '''actual arguments''', as shown below with <code>value1</code> and <code>value2</code>. <syntaxhighlight lang="eiffel"> sum_value: INTEGER value1: INTEGER = 40 value2: INTEGER = 2 β¦ sum_value := sum (value1, value2) </syntaxhighlight> Parameters are also thought of as either '''formal''' or '''actual'''. '''Formal generic parameters''' are used in the definition of generic classes. In the example below, the class <code>HASH_TABLE</code> is declared as a generic class which has two formal generic parameters, <code>G</code> representing data of interest and <code>K</code> representing the hash key for the data: <syntaxhighlight lang="eiffel"> class HASH_TABLE [G, K -> HASHABLE] β¦ </syntaxhighlight> When a class becomes a client to <code>HASH_TABLE</code>, the formal generic parameters are substituted with '''actual generic parameters''' in a '''generic derivation'''. In the following attribute declaration, <code>my_dictionary</code> is to be used as a character string based [[Associative array|dictionary]]. As such, both data and key formal generic parameters are substituted with actual generic parameters of type <code>STRING</code>. <syntaxhighlight lang="eiffel"> my_dictionary: HASH_TABLE [STRING, STRING] </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)