Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Eiffel (programming language)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
===Tuples=== Tuples types may be viewed as a simple form of class, providing only attributes and the corresponding "setter" procedure. A typical tuple type reads <syntaxhighlight lang="eiffel"> TUPLE [name: STRING; weight: REAL; date: DATE] </syntaxhighlight> and could be used to describe a simple notion of birth record if a class is not needed. An instance of such a tuple is simply a sequence of values with the given types, given in brackets, such as <syntaxhighlight lang="eiffel"> ["Brigitte", 3.5, Last_night] </syntaxhighlight> Components of such a tuple can be accessed as if the tuple tags were attributes of a class, for example if <code>t</code> has been assigned the above tuple then <code>t.weight</code> has value 3.5. Thanks to the notion of assigner command (see below), dot notation can also be used to assign components of such a tuple, as in <syntaxhighlight lang="eiffel"> t.weight := t.weight + 0.5 </syntaxhighlight> The tuple tags are optional, so that it is also possible to write a tuple type as <code>TUPLE [STRING, REAL, DATE]</code>. (In some compilers this is the only form of tuple, as tags were introduced with the ECMA standard.) The precise specification of e.g. <code>TUPLE [A, B, C]</code> is that it describes sequences of ''at least'' three elements, the first three being of types <code>A</code>, <code>B</code>, <code>C</code> respectively. As a result, <code>TUPLE [A, B, C]</code> conforms to (may be assigned to) <code>TUPLE [A, B]</code>, to <code>TUPLE [A]</code> and to <code>TUPLE</code> (without parameters), the topmost tuple type to which all tuple types conform.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Eiffel (programming language)
(section)
Add topic