Revision as of 11:59, 13 June 2019 editPauli133 (talk | contribs)Extended confirmed users29,139 editsm →Member availability← Previous edit |
Latest revision as of 23:11, 1 July 2024 edit undoLiz (talk | contribs)Autopatrolled, Checkusers, Oversighters, Administrators771,082 editsm Removing link(s) Misplaced Pages:Articles for deletion/EC (programming language) (2nd nomination) closed as delete (XFDcloser) |
(36 intermediate revisions by 16 users not shown) |
Line 16: |
Line 16: |
|
|<ref>] reserved to himself the use of destruction</ref><ref name="gc">This language uses ] to release unused memory.</ref><!-- I'm not sure if that is the best way to say that. --> |
|
|<ref>] reserved to himself the use of destruction</ref><ref name="gc">This language uses ] to release unused memory.</ref><!-- I'm not sure if that is the best way to say that. --> |
|
|- |
|
|- |
|
| ] (]) |
|
| ] (Dyalog) |
|
| <code>class variable«'''('''parameters''')'''»''';'''</code> or<br /><code>class ''']'''variable '''= ] '''class«'''('''parameters''')'''»''';'''</code> |
|
| <code>variable'''←⎕NEW''' class «parameters»</code> |
|
|
| <code>'''⎕EX <nowiki>'</nowiki>'''variable'''<nowiki>'</nowiki>'''</code> |
|
|
|- |
|
|
| ] |
|
|
| <code>class variable«'''('''parameters''')'''»''';'''</code><ref>This syntax creates an object value with automatic storage duration</ref> or<br /><code>class ''']'''variable '''= ] '''class«'''('''parameters''')'''»''';'''</code><ref>This syntax creates an object with dynamic storage duration and returns a pointer to it</ref> |
|
| <code>''']''' pointer''';'''</code> |
|
| <code>''']''' pointer''';'''</code> |
|
|- |
|
|- |
Line 30: |
Line 34: |
|
| <code>'''destroy('''variable''');'''</code> |
|
| <code>'''destroy('''variable''');'''</code> |
|
|- |
|
|- |
|
|
| eC |
|
| ] |
|
|
| <code>class «instance handle» '''{''' «properties/data members assignments, instance method overrides» '''}'''</code> |
|
| <code>class «instance handle» '''{''' «properties/data members assignments, instance method overrides» '''}'''</code> |
|
| <code>'''delete''' instance handle''';'''</code> |
|
| <code>'''delete''' instance handle''';'''</code> |
Line 66: |
Line 70: |
|
| <code>'''undef($'''variable''');'''</code> |
|
| <code>'''undef($'''variable''');'''</code> |
|
|- |
|
|- |
|
|
| ] |
|
| ] |
|
|
| <code>«'''my '''»$variable '''=''' class'''.new'''«'''('''parameters''')'''»''';'''</code> |
|
| <code>«'''my '''»$variable '''=''' class'''.new'''«'''('''parameters''')'''»''';'''</code> |
|
| <code>$variable'''.undefine;'''</code> |
|
| <code>$variable'''.undefine;'''</code> |
Line 87: |
Line 91: |
|
| ] |
|
| ] |
|
| The class is an Object.<br/>Just send a message to a class, usually <code>#new</code> or <code>#new:</code>, and many others, for example: |
|
| The class is an Object.<br/>Just send a message to a class, usually <code>#new</code> or <code>#new:</code>, and many others, for example: |
|
<source lang="smalltalk"> |
|
<syntaxhighlight lang="smalltalk"> |
|
Point x: 10 y: 20. |
|
Point x: 10 y: 20. |
|
Array with: -1 with: 3 with: 2. |
|
Array with: -1 with: 3 with: 2. |
|
|
</syntaxhighlight> |
|
</source> |
|
|
| |
|
| |
|
|- |
|
|- |
Line 98: |
Line 102: |
|
|- |
|
|- |
|
| {{nowrap|]}} (]) |
|
| {{nowrap|]}} (]) |
|
| <code>ClassVar ''':=''' ClassType.ConstructorName'''('''parameters''');</code> |
|
| <code>ClassVar ''':=''' ClassType.ConstructorName'''('''parameters''')''';</code> |
|
| <code>ClassVar'''.Free;'''</code> |
|
| <code>ClassVar'''.Free;'''</code> |
|
|- |
|
|- |
|
| ] |
|
| ] |
|
| <source lang="scala"> |
|
| <syntaxhighlight lang="scala"> |
|
val obj = new Object // no parameters |
|
val obj = new Object // no parameters |
|
val obj = new Object(arg0, arg1, arg2...) |
|
val obj = new Object(arg0, arg1, arg2...) |
|
val obj = Object(arg0, arg1, arg2...) // case class |
|
val obj = Object(arg0, arg1, arg2...) // case class |
|
val obj = new Object(arg0, arg1, param1 = value1, ...) // named parameters |
|
val obj = new Object(arg0, arg1, param1 = value1, ...) // named parameters |
|
|
</syntaxhighlight> |
|
</source> |
|
|
|<ref name="gc" /> |
|
|<ref name="gc" /> |
|
|- |
|
|- |
Line 114: |
Line 118: |
|
| |
|
| |
|
|- |
|
|- |
|
| ] |
|
| ] |
|
| <code>variable «'''as''' class» '''=''' class'''('''parameters''')'''</code> |
|
| <code>variable «'''as''' class» '''=''' class'''('''parameters''')'''</code> |
|
| <code>variable'''.dispose'''</code> |
|
| <code>variable'''.dispose'''</code> |
Line 136: |
Line 140: |
|
| {{n/a}} |
|
| {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| APL (Dyalog) |
|
|
| <code>''':Class''' name «''':'''parentclass» «''','''interfaces»</code><br/><code>members</code><br><code>''':EndClass'''</code> |
|
|
| <code>''':Interface''' name</code><br><code>members</code><br><code>''':EndInterface'''</code> |
|
|
| <code>''':Namespace''' name</code><br><code>members</code><br><code>''':EndNamespace'''</code> |
|
|
|- |
|
|
| C++ |
|
| <code>'''class '''name«''' : public '''parentclasses</code><ref name="multi">This language supports ]. A class can have more than one parent class</ref><code>»''' { '''members''' };'''</code> |
|
| <code>'''class '''name«''' : public '''parentclasses</code><ref name="multi">This language supports ]. A class can have more than one parent class</ref><code>»''' { '''members''' };'''</code> |
|
| |
|
| |
Line 143: |
Line 152: |
|
| C# |
|
| C# |
|
| rowspan=2| <code>'''class '''name«''' : '''«parentclass»«''',''' interfaces»»''' { '''members''' }'''</code> |
|
| rowspan=2| <code>'''class '''name«''' : '''«parentclass»«''',''' interfaces»»''' { '''members''' }'''</code> |
|
| rowspan=2| <code>'''interface '''name«''' : '''parentinterfaces» { '''members''' }'''</code> |
|
| rowspan=2| <code>'''interface''' name« ''':''' parentinterfaces» '''{''' members '''}'''</code> |
|
|- |
|
|- |
|
| D |
|
| D |
Line 195: |
Line 204: |
|
| <code>'''package '''name''';''' members</code> |
|
| <code>'''package '''name''';''' members</code> |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>'''class '''name «'''is''' parentclass «'''is''' parentclass ...<ref name="multi" />»» «'''does''' role «'''does''' role ...»» '''{''' members '''}'''</code> |
|
| <code>'''class '''name «'''is''' parentclass «'''is''' parentclass ...<ref name="multi" />»» «'''does''' role «'''does''' role ...»» '''{''' members '''}'''</code> |
|
| <code>'''role '''name «'''does''' role «'''does''' role ...»» '''{''' members '''}'''</code> |
|
| <code>'''role '''name «'''does''' role «'''does''' role ...»» '''{''' members '''}'''</code> |
Line 243: |
Line 252: |
|
|- |
|
|- |
|
| Scala |
|
| Scala |
|
| <source lang="scala"> |
|
| <syntaxhighlight lang="scala"> |
|
class ConcreteClass(constructor params) |
|
class ConcreteClass(constructor params) |
|
extends ParentClass |
|
extends ParentClass |
Line 249: |
Line 258: |
|
// members |
|
// members |
|
} |
|
} |
|
|
</syntaxhighlight> |
|
</source> |
|
|
| <source lang="scala"> |
|
| <syntaxhighlight lang="scala"> |
|
trait TraitName |
|
trait TraitName |
|
extends OtherTrait1 |
|
extends OtherTrait1 |
Line 256: |
Line 265: |
|
// members |
|
// members |
|
} |
|
} |
|
|
</syntaxhighlight> |
|
</source> |
|
|
| <source lang="scala"> |
|
| <syntaxhighlight lang="scala"> |
|
package name |
|
package name |
|
|
</syntaxhighlight> |
|
</source> |
|
|
|- |
|
|- |
|
| COBOL |
|
| COBOL |
|
| <code>'''CLASS-ID.''' name« '''INHERITS'''« '''FROM'''» parentclasses»'''.''' |
|
| <code>'''CLASS-ID.''' name« '''INHERITS'''« '''FROM'''» parentclasses»'''.'''</code> |
|
<ul>'''FACTORY'''« '''IMPLEMENTS''' interfaces»'''.'''</ul> |
|
<ul><code>'''FACTORY'''« '''IMPLEMENTS''' interfaces»'''.'''</code></ul> |
|
<ul>class-members</ul> |
|
<ul><code>class-members</code></ul> |
|
'''END FACTORY.'''</ul> |
|
<ul><code>'''END FACTORY.'''</code></ul> |
|
<ul>'''OBJECT'''« '''IMPLEMENTS''' interfaces»'''.'''</ul> |
|
<ul><code>'''OBJECT'''« '''IMPLEMENTS''' interfaces»'''.'''</code></ul> |
|
<ul>instance-members</ul> |
|
<ul><code>instance-members</code></ul> |
|
'''END OBJECT.'''</ul> |
|
<ul><code>'''END OBJECT.'''</code></ul> |
|
'''END CLASS''' name'''.'''</code> |
|
<code>'''END CLASS''' name'''.'''</code> |
|
| <code>'''INTERFACE-ID.''' name« '''INHERITS'''« '''FROM'''» interfaces»'''.''' |
|
| <code>'''INTERFACE-ID.''' name« '''INHERITS'''« '''FROM'''» interfaces»'''.'''</code> |
|
<ul>members</ul> |
|
<ul><code>members</code></ul> |
|
'''END INTERFACE''' name'''.'''</code> |
|
<code>'''END INTERFACE''' name'''.'''</code> |
|
| {{n/a}} |
|
| {{n/a}} |
|
|- |
|
|- |
Line 300: |
Line 309: |
|
| colspan=2 {{n/a}} |
|
| colspan=2 {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| APL (Dyalog) |
|
|
| <code>'''∇''' name</code><br><code>''':Implements Constructor''' «''':Base''' «expr»»</code><br><code>instructions</code><br><code>'''∇'''</code> |
|
|
| |
|
|
| <code>'''∇''' name</code><br><code>''':Implements Destructor'''</code><br><code>instructions</code><br><code>'''∇'''</code> |
|
|
|- |
|
|
| C++ |
|
| <code>class'''('''«parameters»''') '''«''': '''initializers</code><ref>An optional comma-separated list of initializers for member objects and parent classes goes here. The syntax for initializing member objects is |
|
| <code>class'''('''«parameters»''') '''«''': '''initializers</code><ref>An optional comma-separated list of initializers for member objects and parent classes goes here. The syntax for initializing member objects is |
|
:<code>"member_name'''('''parameters''')'''"</code> |
|
:<code>"member_name'''('''parameters''')'''"</code> |
|
This works even for primitive members, in which case one parameter is specified and that value is copied into the member. The syntax for initializing parent classes is |
|
This works even for primitive members, in which case one parameter is specified and that value is copied into the member. The syntax for initializing parent classes is |
|
:<code>"class_name'''('''parameters''')'''".</code> |
|
:<code>"class_name'''('''parameters''')'''".</code> |
|
If an initializer is not specified for a member or parent class, then the default constructor is used.</ref><code>»''' { '''instructions''' }'''</code> |
|
If an initializer is not specified for a member or parent class, then the ] is used.</ref><code>»''' { '''instructions''' }'''</code> |
|
| <code>'''~'''class'''() { '''instructions''' }'''</code> |
|
| <code>'''~'''class'''() { '''instructions''' }'''</code> |
|
| |
|
| |
Line 369: |
Line 383: |
|
| |
|
| |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>'''submethod BUILD {''' instructions '''}''' or<br /> «'''multi''' » '''method new('''««$self''':''' »parameters»''') { self.bless(*, '''field1 '''=>''' value1, ...''');''' ... instructions '''}'''</code> |
|
| <code>'''submethod BUILD {''' instructions '''}''' or<br /> «'''multi''' » '''method new('''««$self''':''' »parameters»''') { self.bless(*, '''field1 '''=>''' value1, ...''');''' ... instructions '''}'''</code> |
|
| <code>'''submethod DESTROY {''' instructions '''}'''</code> |
|
| <code>'''submethod DESTROY {''' instructions '''}'''</code> |
Line 426: |
Line 440: |
|
|<ref>In ABAP, specific fields or methods are not declared as accessible by outside things. Rather, outside classes are declared as friends to have access to the class's fields or methods.</ref> |
|
|<ref>In ABAP, specific fields or methods are not declared as accessible by outside things. Rather, outside classes are declared as friends to have access to the class's fields or methods.</ref> |
|
|- |
|
|- |
|
| C++ (STL) |
|
| APL (Dyalog) |
|
|
| <code>''':Field Public''' field «'''←''' value»</code> |
|
|
| <code>''':Field''' «'''Private'''» field «'''←''' value»</code> |
|
|
| |
|
|
| |
|
|
|- |
|
|
| C++ |
|
| <code>'''public: '''type field''';'''</code> |
|
| <code>'''public: '''type field''';'''</code> |
|
| <code>'''private: '''type field''';'''</code> |
|
| <code>'''private: '''type field''';'''</code> |
Line 468: |
Line 488: |
|
| colspan=2 {{n/a}} |
|
| colspan=2 {{n/a}} |
|
|<ref>Just send a message to the class |
|
|<ref>Just send a message to the class |
|
<source lang="smalltalk"> |
|
<syntaxhighlight lang="smalltalk"> |
|
class addInstVarName: field. |
|
class addInstVarName: field. |
|
class removeInstVarName: field. |
|
class removeInstVarName: field. |
|
</source></ref> |
|
</syntaxhighlight></ref> |
|
| {{n/a}} |
|
| {{n/a}} |
|
|- |
|
|- |
Line 501: |
Line 521: |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>'''has'''« type »$'''.'''field« '''is rw'''»</code> |
|
| <code>'''has'''« type »$'''.'''field« '''is rw'''»</code> |
|
| <code>'''has'''« type »$'''!'''field</code> |
|
| <code>'''has'''« type »$'''!'''field</code> |
Line 560: |
Line 580: |
|
| <code>'''methods''' name «'''importing''' parameter = argument» «'''exporting''' parameter = argument» «'''changing''' parameter = argument» «'''returning value('''parameter''')'''»<br />'''method''' name'''.''' instructions '''endmethod.'''</code><ref>The declaration and implementation of methods in ABAP are separate. '''methods''' statement is to be used inside the class definition. '''method''' (without "s") is to be used inside the class implementation. '''parameter = argument''' can be repeated if there are several parameters.</ref> |
|
| <code>'''methods''' name «'''importing''' parameter = argument» «'''exporting''' parameter = argument» «'''changing''' parameter = argument» «'''returning value('''parameter''')'''»<br />'''method''' name'''.''' instructions '''endmethod.'''</code><ref>The declaration and implementation of methods in ABAP are separate. '''methods''' statement is to be used inside the class definition. '''method''' (without "s") is to be used inside the class implementation. '''parameter = argument''' can be repeated if there are several parameters.</ref> |
|
|<ref>In ABAP, the return parameter name is explicitly defined in the method signature within the class definition</ref> |
|
|<ref>In ABAP, the return parameter name is explicitly defined in the method signature within the class definition</ref> |
|
|
|- valign="top" |
|
|
| APL (Dyalog) |
|
|
| <code>'''∇''' «left argument» name «right arguments»</code><br><code>instructions</code><br><code>'''∇'''</code> |
|
|
| <code>'''∇''' result '''←''' «left argument» name «right arguments»</code><br><code>instructions</code><br><code>'''∇'''</code> |
|
|- valign="top" |
|
|- valign="top" |
|
| C++<ref>In C++, declaring and implementing methods is usually separate. Methods are declared in the class definition (which is usually included in a ]) using the syntax</ref> |
|
| C++<ref>In C++, declaring and implementing methods is usually separate. Methods are declared in the class definition (which is usually included in a ]) using the syntax</ref> |
Line 611: |
Line 635: |
|
| <code>'''sub '''foo''' { my ($self'''«''', '''parameters»''') = @_; '''instructions ... '''return''' value'''; }'''</code> |
|
| <code>'''sub '''foo''' { my ($self'''«''', '''parameters»''') = @_; '''instructions ... '''return''' value'''; }'''</code> |
|
|- valign="top" |
|
|- valign="top" |
|
| Perl 6 |
|
| Raku |
|
| <code>«'''has''' »«'''multi''' »'''method '''foo'''('''««$self''': ''' »parameters»''') { '''instructions''' }'''</code> |
|
| <code>«'''has''' »«'''multi''' »'''method '''foo'''('''««$self''': ''' »parameters»''') { '''instructions''' }'''</code> |
|
| <code>«'''has''' «type »»«'''multi''' »'''method '''foo'''('''««$self''': ''' »parameters»''') { '''instructions ... '''return''' value'''; }'''</code> |
|
| <code>«'''has''' «type »»«'''multi''' »'''method '''foo'''('''««$self''': ''' »parameters»''') { '''instructions ... '''return''' value'''; }'''</code> |
Line 639: |
Line 663: |
|
|- valign="top" |
|
|- valign="top" |
|
| COBOL |
|
| COBOL |
|
| <code>'''METHOD-ID.''' foo'''.'''<br/> |
|
| <code>'''METHOD-ID.''' foo'''.'''<br/>«'''DATA DIVISION.'''<br/>'''LINKAGE SECTION.'''<br/>parameter declarations»<br/>'''PROCEDURE DIVISION'''« '''USING''' parameters»'''.'''</code> |
|
|
<ul><code>instructions</code></ul> |
|
«'''DATA DIVISION.'''<br/> |
|
|
'''LINKAGE SECTION.'''<br/> |
|
<code>'''END METHOD''' foo'''.'''</code> |
|
|
| <code>'''METHOD-ID.''' foo'''.'''<br/>'''DATA DIVISION.'''<br/>'''LINKAGE SECTION.'''<br/>«parameter declarations»<br/>result-var declaration<br/>'''PROCEDURE DIVISION'''« '''USING''' parameters» '''RETURNING''' result-var'''.'''</code> |
|
parameter declarations»<br/> |
|
|
|
<ul><code>instructions</code></ul> |
|
'''PROCEDURE DIVISION'''« '''USING''' parameters»'''.''' |
|
|
|
<code>'''END METHOD''' foo'''.'''</code> |
|
<ul>instructions</ul> |
|
|
'''END METHOD''' foo'''.'''</code> |
|
|
| <code>'''METHOD-ID.''' foo'''.'''<br/> |
|
|
'''DATA DIVISION.'''<br/> |
|
|
'''LINKAGE SECTION.'''<br/> |
|
|
«parameter declarations»<br/> |
|
|
result-var declaration<br/> |
|
|
'''PROCEDURE DIVISION'''« '''USING''' parameters» '''RETURNING''' result-var'''.''' |
|
|
<ul>instructions</ul> |
|
|
'''END METHOD''' foo'''.'''</code> |
|
|
|- |
|
|- |
|
| Cobra |
|
| Cobra |
Line 661: |
Line 676: |
|
|- |
|
|- |
|
| ISLISP |
|
| ISLISP |
|
| <code>('''defgeneric''' method (arg1 arg2))<br> |
|
| <code>('''defgeneric''' method (arg1 arg2))<br>('''defmethod''' method ((arg1 <class1> arg2 <class2>) ...)</code> |
|
('''defmethod''' method ((arg1 <class1> arg2 <class2>) ...)</code> |
|
|
| |
|
| |
|
|} |
|
|} |
Line 680: |
Line 694: |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
|
| C++ (STL) |
|
| APL (Dyalog) |
|
|
| <code>''':Property''' Bar</code><br><code>'''∇''' result '''← Get'''</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>'''∇ Set''' arguments</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>''':EndProperty''' Bar</code> |
|
|
| <code>''':Property''' Bar</code><br><code>'''∇''' result '''← Get'''</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>''':EndProperty''' Bar</code> |
|
|
| <code>''':Property''' Bar</code><br><code>'''∇ Set''' arguments</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>''':EndProperty''' Bar</code> |
|
|
|- valign="top" |
|
|
| C++ |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
Line 703: |
Line 722: |
|
| Objective-C 2.0 (Cocoa) |
|
| Objective-C 2.0 (Cocoa) |
|
| <code>'''@property (readwrite)''' type bar''';''' <br /></code> and then inside <br/><code>@implementation <br /> '''- ('''type''')'''bar''' { '''instructions''' }''' <br /> '''- (void)'''setBar''':('''type''')'''value''' { '''instructions''' }'''</code> |
|
| <code>'''@property (readwrite)''' type bar''';''' <br /></code> and then inside <br/><code>@implementation <br /> '''- ('''type''')'''bar''' { '''instructions''' }''' <br /> '''- (void)'''setBar''':('''type''')'''value''' { '''instructions''' }'''</code> |
|
| <code>'''@property (readonly)''' type bar''';''' <br /></code> and then inside <br/><code>@implementation <br /> |
|
| <code>'''@property (readonly)''' type bar''';''' <br /></code> and then inside <br/><code>@implementation <br /> '''- ('''type''')'''bar''' { '''instructions''' }'''</code> |
|
'''- ('''type''')'''bar''' { '''instructions''' }'''</code> |
|
|
| {{n/a}} |
|
| {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
Line 719: |
Line 737: |
|
| Python |
|
| Python |
|
| <code>'''def''' setBar'''(self, '''value'''):''' <br />{{keypress|Tab}} instructions'''<br />def''' getBar'''(self):<br />{{keypress|Tab}} '''instructions<br />{{keypress|Tab}} '''return''' value<br />bar''' = property('''getBar''',''' setBar''')'''</code><ref>Alternative implementation: |
|
| <code>'''def''' setBar'''(self, '''value'''):''' <br />{{keypress|Tab}} instructions'''<br />def''' getBar'''(self):<br />{{keypress|Tab}} '''instructions<br />{{keypress|Tab}} '''return''' value<br />bar''' = property('''getBar''',''' setBar''')'''</code><ref>Alternative implementation: |
|
<source lang="python"> |
|
<syntaxhighlight lang="python"> |
|
def bar(): |
|
def bar(): |
|
doc = "The bar property." |
|
doc = "The bar property." |
Line 728: |
Line 746: |
|
return locals() |
|
return locals() |
|
bar = property(**bar()) |
|
bar = property(**bar()) |
|
|
</syntaxhighlight> |
|
</source> |
|
|
</ref> |
|
</ref> |
|
| <code>'''def''' getBar'''(self):''' <br />{{keypress|Tab}} instructions<br />{{keypress|Tab}} '''return''' value<br />bar''' = property('''getBar''')'''</code> |
|
| <code>'''def''' getBar'''(self):''' <br />{{keypress|Tab}} instructions<br />{{keypress|Tab}} '''return''' value<br />bar''' = property('''getBar''')'''</code> |
Line 744: |
Line 762: |
|
|- valign="top" |
|
|- valign="top" |
|
| PHP |
|
| PHP |
|
| <code>'''function __get('''$property''') {<br/> switch ('''$property''') {<br/> case ''''Bar'''' : '''instructions ... '''return''' value''';<br/> } }<br />function __set('''$property''', '''$value''') {<br/> switch ('''$property''') {<br/> case ''''Bar'''' : '''instructions'''<br/> } }'''</code> |
|
| <code>'''function __get('''$property''') {<br/> switch ('''$property''') {<br/> case '''{{'}}Bar{{'}}''' : '''instructions ... '''return''' value''';<br/> } }<br />function __set('''$property''', '''$value''') {<br/> switch ('''$property''') {<br/> case '''{{'}}Bar{{'}}''' : '''instructions'''<br/> } }'''</code> |
|
| <code>'''function __get('''$property''') {<br/> switch ($'''property''') {<br/> case ''''Bar'''' : '''instructions ... '''return''' value''';<br/> } }'''</code> |
|
| <code>'''function __get('''$property''') {<br/> switch ($'''property''') {<br/> case '''{{'}}Bar{{'}}''' : '''instructions ... '''return''' value''';<br/> } }'''</code> |
|
| <code>'''function __set('''$property''', '''$value''') {<br/> switch ('''$property''') {<br/> case ''''Bar'''' : '''instructions'''<br/> } }'''</code> |
|
| <code>'''function __set('''$property''', '''$value''') {<br/> switch ('''$property''') {<br/> case '''{{'}}Bar{{'}}''' : '''instructions'''<br/> } }'''</code> |
|
|- valign="top" |
|
|- valign="top" |
|
| Perl |
|
| Perl |
Line 753: |
Line 771: |
|
| <code>'''sub''' Bar {<br /> '''my''' $self = '''shift''';<br /> '''if''' ('''my''' $Bar = '''shift''') {<br /> # setter<br /> $self->{Bar} = $Bar;<br /> return $self;<br /> } '''else''' {<br /> # write-only<br /> '''die''' "Bar is write-only\n"; <br /> }<br />}</code> |
|
| <code>'''sub''' Bar {<br /> '''my''' $self = '''shift''';<br /> '''if''' ('''my''' $Bar = '''shift''') {<br /> # setter<br /> $self->{Bar} = $Bar;<br /> return $self;<br /> } '''else''' {<br /> # write-only<br /> '''die''' "Bar is write-only\n"; <br /> }<br />}</code> |
|
|- valign="top" |
|
|- valign="top" |
|
| Perl 6 |
|
| Raku |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
Line 780: |
Line 798: |
|
|- valign="top" |
|
|- valign="top" |
|
| COBOL |
|
| COBOL |
|
| <code>'''METHOD-ID. GET PROPERTY''' bar'''.'''<br/> |
|
| <code>'''METHOD-ID. GET PROPERTY''' bar'''.'''<br/>'''DATA DIVISION.'''<br/>'''LINKAGE SECTION.'''<br/>return-var declaration<br/>'''PROCEDURE DIVISION RETURNING''' return-var'''.'''</code> |
|
|
<ul><code>instructions</code></ul> |
|
'''DATA DIVISION.'''<br/> |
|
|
|
<code>'''END METHOD.'''<br/>'''METHOD-ID. SET PROPERTY''' bar'''.'''<br/>'''DATA DIVISION.'''<br/>'''LINKAGE SECTION.'''<br/>value-var declaration<br/>'''PROCEDURE DIVISION USING''' value-var'''.'''</code> |
|
'''LINKAGE SECTION.'''<br/> |
|
|
|
<ul><code>instructions</code></ul> |
|
return-var declaration<br/> |
|
|
|
<code>'''END METHOD.'''</code> |
|
'''PROCEDURE DIVISION RETURNING''' return-var'''.''' |
|
|
|
| <code>'''METHOD-ID. GET PROPERTY''' bar'''.'''<br/>'''DATA DIVISION.'''<br/>'''LINKAGE SECTION.'''<br/>return-var declaration<br/>'''PROCEDURE DIVISION RETURNING''' return-var'''.'''</code> |
|
<ul>instructions</ul> |
|
|
|
<ul><code>instructions</code></ul> |
|
'''END METHOD.'''<br/> |
|
|
'''METHOD-ID. SET PROPERTY''' bar'''.'''<br/> |
|
<code>'''END METHOD.'''</code> |
|
|
| <code>'''METHOD-ID. SET PROPERTY''' bar'''.'''<br/>'''DATA DIVISION.'''<br/>'''LINKAGE SECTION.'''<br/>value-var declaration<br/>'''PROCEDURE DIVISION USING''' value-var'''.'''</code> |
|
'''DATA DIVISION.'''<br/> |
|
|
|
<ul><code>instructions</code></ul> |
|
'''LINKAGE SECTION.'''<br/> |
|
|
|
<code>'''END METHOD.'''</code> |
|
value-var declaration<br/> |
|
|
'''PROCEDURE DIVISION USING''' value-var'''.''' |
|
|
<ul>instructions</ul> |
|
|
'''END METHOD.'''</code> |
|
|
| <code>'''METHOD-ID. GET PROPERTY''' bar'''.'''<br/> |
|
|
'''DATA DIVISION.'''<br/> |
|
|
'''LINKAGE SECTION.'''<br/> |
|
|
return-var declaration<br/> |
|
|
'''PROCEDURE DIVISION RETURNING''' return-var'''.''' |
|
|
<ul>instructions</ul> |
|
|
'''END METHOD.'''</code> |
|
|
| <code>'''METHOD-ID. SET PROPERTY''' bar'''.'''<br/> |
|
|
'''DATA DIVISION.'''<br/> |
|
|
'''LINKAGE SECTION.'''<br/> |
|
|
value-var declaration<br/> |
|
|
'''PROCEDURE DIVISION USING''' value-var'''.''' |
|
|
<ul>instructions</ul> |
|
|
'''END METHOD.'''</code> |
|
|
|- |
|
|- |
|
| Cobra |
|
| Cobra |
Line 829: |
Line 830: |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
|
| C++ (STL) |
|
| C++ |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
Line 878: |
Line 879: |
|
| <code>'''use''' '''base''' '''qw'''(Class::Accessor);<br />'''__PACKAGE__'''->'''mk_wo_accessors'''('Bar');</code> |
|
| <code>'''use''' '''base''' '''qw'''(Class::Accessor);<br />'''__PACKAGE__'''->'''mk_wo_accessors'''('Bar');</code> |
|
|- valign="top" |
|
|- valign="top" |
|
| Perl 6 |
|
| Raku |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
Line 922: |
Line 923: |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| C++ |
|
| <code>type '''operator''' symbol '''() { '''instructions''' }'''</code> |
|
| <code>type '''operator''' symbol '''() { '''instructions''' }'''</code> |
|
| <code>type '''operator''' symbol '''('''type operand2''') { '''instructions''' }'''</code> |
|
| <code>type '''operator''' symbol '''('''type operand2''') { '''instructions''' }'''</code> |
Line 955: |
Line 956: |
|
| <code>'''def __'''opname'''__(self): <br /> {{keypress|Tab}} '''instructions'''<br /> {{keypress|Tab}} return '''value</code> |
|
| <code>'''def __'''opname'''__(self): <br /> {{keypress|Tab}} '''instructions'''<br /> {{keypress|Tab}} return '''value</code> |
|
| <code>'''def __'''opname'''__(self, '''operand2'''): <br /> {{keypress|Tab}} '''instructions'''<br /> {{keypress|Tab}} return '''value</code> |
|
| <code>'''def __'''opname'''__(self, '''operand2'''): <br /> {{keypress|Tab}} '''instructions'''<br /> {{keypress|Tab}} return '''value</code> |
|
| <code>'''def __call__(self'''«''', '''paramters»'''): <br /> {{keypress|Tab}} '''instructions'''<br /> {{keypress|Tab}} return '''value</code> |
|
| <code>'''def __call__(self'''«''', '''parameters»'''): <br /> {{keypress|Tab}} '''instructions'''<br /> {{keypress|Tab}} return '''value</code> |
|
|- |
|
|- |
|
| Visual Basic .NET |
|
| Visual Basic .NET |
Line 967: |
Line 968: |
|
|- |
|
|- |
|
| PHP |
|
| PHP |
|
| colspan=2|<ref>PHP does not support operator overloading natively, but support can be added using the .</ref> |
|
| colspan=2|<ref>PHP does not support ] natively, but support can be added using the .</ref> |
|
| <code>'''function __invoke('''«parameters»''') { '''instructions''' }''' (PHP 5.3+)</code> |
|
| <code>'''function __invoke('''«parameters»''') { '''instructions''' }''' (PHP 5.3+)</code> |
|
|- |
|
|- |
Line 975: |
Line 976: |
|
| |
|
| |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>«'''our''' «type »»«'''multi''' »'''method prefix:<'''symbol'''> ('''«$operand''':''' »''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method postfix:<'''symbol'''> ('''«$operand''':''' »''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method circumfix:<'''symbol1 symbol2'''> ('''«$operand''':''' »''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
|
| <code>«'''our''' «type »»«'''multi''' »'''method prefix:<'''symbol'''> ('''«$operand''':''' »''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method postfix:<'''symbol'''> ('''«$operand''':''' »''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method circumfix:<'''symbol1 symbol2'''> ('''«$operand''':''' »''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
|
| <code>«'''our''' «type »»«'''multi''' »'''method infix:<'''symbol'''> ('''«$operand1''':''' » type operand2''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
|
| <code>«'''our''' «type »»«'''multi''' »'''method infix:<'''symbol'''> ('''«$operand1''':''' » type operand2''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
Line 1,013: |
Line 1,014: |
|
| colspan=3 {{n/a}} |
|
| colspan=3 {{n/a}} |
|
|- valign="top" |
|
|- valign="top" |
|
| C++ (STL) |
|
| APL (Dyalog) |
|
|
| <code>''':Property Numbered Default''' name</code><br><code>'''∇''' result '''← Get'''</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>'''∇ Set''' arguments</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>''':EndProperty''' Bar</code> |
|
|
| <code>''':Property Numbered Default''' Bar</code><br><code>'''∇''' result '''← Get'''</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>''':EndProperty''' Bar</code> |
|
|
| <code>''':Property Numbered Default''' Bar</code><br><code>'''∇ Set''' arguments</code><br><code>instructions</code><br><code>'''∇'''</code><br><code>''':EndProperty''' Bar</code> |
|
|
|- valign="top" |
|
|
| C++ |
|
| <code>type'''& operator('''type index''') { '''instructions''' }'''</code> |
|
| <code>type'''& operator('''type index''') { '''instructions''' }'''</code> |
|
| <code>type '''operator('''type index''') { '''instructions''' }'''</code> |
|
| <code>type '''operator('''type index''') { '''instructions''' }'''</code> |
Line 1,062: |
Line 1,068: |
|
|colspan=3|<ref>The class must overload '@{}' (array dereference) or subclass one of Tie::Array or Tie::StdArray to hook array operations</ref> |
|
|colspan=3|<ref>The class must overload '@{}' (array dereference) or subclass one of Tie::Array or Tie::StdArray to hook array operations</ref> |
|
|- valign="top" |
|
|- valign="top" |
|
| Perl 6 |
|
| Raku |
|
| <code>«'''our''' «type »»«'''multi''' »'''method postcircumfix:<> is rw ('''«$self''':''' » type $index''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method postcircumfix:<{ }> is rw ('''«$self''':''' » type $key''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
|
| <code>«'''our''' «type »»«'''multi''' »'''method postcircumfix:<> is rw ('''«$self''':''' » type $index''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method postcircumfix:<{ }> is rw ('''«$self''':''' » type $key''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
|
| <code>«'''our''' «type »»«'''multi''' »'''method postcircumfix:<>('''«$self''':''' » type $index''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method postcircumfix:<{ }> ('''«$self''':''' » type $key''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
|
| <code>«'''our''' «type »»«'''multi''' »'''method postcircumfix:<>('''«$self''':''' » type $index''') {''' instructions ... '''return '''value''';''' '''}''' or<br /> «'''our''' «type »»«'''multi''' »'''method postcircumfix:<{ }> ('''«$self''':''' » type $key''') {''' instructions ... '''return '''value''';''' '''}'''</code> |
Line 1,100: |
Line 1,106: |
|
| colspan=2 {{n/a}} |
|
| colspan=2 {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| C++ |
|
| |
|
| |
|
| <code>'''operator '''returntype'''() { '''instructions''' }'''</code> |
|
| <code>'''operator '''returntype'''() { '''instructions''' }'''</code> |
Line 1,110: |
Line 1,116: |
|
| D |
|
| D |
|
| |
|
| |
|
| <code>T '''opCast('''T''')() if (is('''T''' == '''type''')) { '''instructions''' }</code> |
|
| <code>T '''opCast('''T''')() if (is('''T''' == '''type''')) { '''instructions''' }'''</code> |
|
|- |
|
|- |
|
| eC |
|
| eC |
|
| |
|
| |
|
| <code>'''property''' T '''{ get { return''' «conversion code»'''; } }</code> |
|
| <code>'''property''' T '''{ get { return''' «conversion code»'''; } }'''</code> |
|
|- |
|
|- |
|
| Java |
|
| Java |
Line 1,128: |
Line 1,134: |
|
| <code>'''Shared Narrowing Operator CType('''operand''' As '''type''') As '''returntype''' <br /> '''instructions ''' <br /> End Operator''' </code> |
|
| <code>'''Shared Narrowing Operator CType('''operand''' As '''type''') As '''returntype''' <br /> '''instructions ''' <br /> End Operator''' </code> |
|
| <code>'''Shared Widening Operator CType('''operand''' As '''type''') As '''returntype''' <br /> '''instructions ''' <br /> End Operator'''</code> |
|
| <code>'''Shared Widening Operator CType('''operand''' As '''type''') As '''returntype''' <br /> '''instructions ''' <br /> End Operator'''</code> |
|
|- |
|
|
| Perl 6 |
|
|
| |
|
|
| <code>'''multi method '''type«'''('''$self''':)'''» '''is export {''' instructions '''}'''</code> |
|
|
|- |
|
|- |
|
| PHP |
|
| PHP |
|
| rowspan=5 colspan=2 {{n/a}} |
|
| rowspan=2 colspan=2 {{n/a}} |
|
|- |
|
|- |
|
| Perl |
|
| Perl |
|
|
|- |
|
|
| Raku |
|
|
| |
|
|
| <code>'''multi method '''type«'''('''$self''':)'''» '''is export {''' instructions '''}'''</code> |
|
|- |
|
|- |
|
| Ruby |
|
| Ruby |
|
|
| rowspan=3 colspan=2 {{n/a}} |
|
|- |
|
|- |
|
| Windows PowerShell |
|
| Windows PowerShell |
Line 1,168: |
Line 1,175: |
|
|- |
|
|- |
|
| ABAP Objects |
|
| ABAP Objects |
|
| <code>'''x->'''method'''(«'''parameters»''').'''</code><ref name="abapparam">In ABAP, arguments must be passed using this syntax:<code> |
|
| <code>'''x->'''method'''(«'''parameters»''').'''</code><ref name="abapparam">In ABAP, arguments must be passed using this syntax: |
|
:'''x->'''method'''('''«'''exporting''' parameter = argument» «'''importing''' parameter = argument» «'''changing''' parameter = argument» «'''returning value('''parameter''')'''» |
|
:<code>'''x->'''method'''('''«'''exporting''' parameter = argument» «'''importing''' parameter = argument» «'''changing''' parameter = argument» «'''returning value('''parameter''')'''»</code> |
|
:'''parameter = argument'''</code> can be repeated if there are several parameters</ref> |
|
:<code>'''parameter = argument'''</code> can be repeated if there are several parameters</ref> |
|
| <code>'''x->'''field</code> |
|
| <code>'''x->'''field</code> |
|
| {{n/a}} |
|
| {{n/a}} |
Line 1,176: |
Line 1,183: |
|
| {{n/a}} |
|
| {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| C++ |
|
| <code>'''x.'''method'''('''parameters''')''' or<br />'''ptr->'''method'''('''parameters''')'''</code> |
|
| <code>'''x.'''method'''('''parameters''')''' or<br />'''ptr->'''method'''('''parameters''')'''</code> |
|
| <code>'''x.'''field or<br />'''ptr->'''field</code> |
|
| <code>'''x.'''field or<br />'''ptr->'''field</code> |
Line 1,203: |
Line 1,210: |
|
| <code>cls'''.'''member</code> |
|
| <code>cls'''.'''member</code> |
|
| |
|
| |
|
|
|- |
|
|
| APL (Dyalog) |
|
|
| <code>left argument» '''x.'''method «right argument(s)»</code> |
|
|
| rowspan=8| <code>'''x.'''field</code> |
|
|
| <code>'''x.'''property</code> |
|
|
| rowspan=7| <code>cls'''.'''member</code> |
|
|
| rowspan=9| <code>ns'''.'''member</code> |
|
|- |
|
|- |
|
| C# |
|
| C# |
|
| rowspan=8| <code>'''x.'''method'''('''parameters''')'''</code> |
|
| rowspan=8| <code>'''x.'''method'''('''parameters''')'''</code> |
|
| rowspan=7| <code>'''x.'''field</code> |
|
|
| <code>'''x.'''property</code> |
|
|
| rowspan=6| <code>cls'''.'''member</code> |
|
|
| rowspan=8| <code>ns'''.'''member</code> |
|
|
|- |
|
|- |
|
| Java |
|
| Java |
Line 1,263: |
Line 1,273: |
|
| <code>ns'''::'''member</code> |
|
| <code>ns'''::'''member</code> |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>'''x.'''method«'''('''parameters''')'''» or<br /> '''x!'''method«'''('''parameters''')'''»</code> |
|
| <code>'''x.'''method«'''('''parameters''')'''» or<br /> '''x!'''method«'''('''parameters''')'''»</code> |
|
| <code>'''x.'''field or<br /> '''x!'''field</code> |
|
| <code>'''x.'''field or<br /> '''x!'''field</code> |
Line 1,280: |
Line 1,290: |
|
| <code>'''x.'''field<br />'''x'''</code> |
|
| <code>'''x.'''field<br />'''x'''</code> |
|
| <code>'''x.'''property<br />'''x'''</code> |
|
| <code>'''x.'''property<br />'''x'''</code> |
|
|
| <code>'''cls.'''member<br />'''cls'''</code> |
|
| {{n/a}} |
|
|
| {{n/a}} |
|
| {{n/a}} |
|
|- |
|
|- |
|
| COBOL |
|
| COBOL |
|
| <code>'''INVOKE x''' '''"'''method'''"''' «'''USING''' parameters» «'''RETURNING''' result» or<br/> |
|
| <code>'''INVOKE x''' '''"'''method'''"''' «'''USING''' parameters» «'''RETURNING''' result» or<br/>'''x::"'''method'''"'''«'''('''«parameters»''')'''»</code> |
|
'''x::"'''method'''"'''«'''('''«parameters»''')'''»</code> |
|
|
| {{n/a}} |
|
| {{n/a}} |
|
| <code>property '''OF x'''</code> |
|
| <code>property '''OF x'''</code> |
|
| <code>'''INVOKE''' cls '''"'''method'''"''' «'''USING''' parameters» «'''RETURNING''' result» or<br/> |
|
| <code>'''INVOKE''' cls '''"'''method'''"''' «'''USING''' parameters» «'''RETURNING''' result» or<br/>cls'''::"'''method'''"'''«'''('''«parameters»''')'''» or<br/>property '''OF''' cls</code> |
|
cls'''::"'''method'''"'''«'''('''«parameters»''')'''» or<br/> |
|
|
property '''OF''' cls</code> |
|
|
| {{n/a}} |
|
| {{n/a}} |
|
|- |
|
|- |
Line 1,313: |
Line 1,320: |
|
! Method |
|
! Method |
|
! Field |
|
! Field |
|
|
|- |
|
|
| APL (Dyalog) |
|
|
| <code>'''3=x.⎕NC<nowiki>'</nowiki>'''method'''<nowiki>'</nowiki>'''</code> |
|
|
| <code>'''2=x.⎕NC<nowiki>'</nowiki>'''method'''<nowiki>'</nowiki>'''</code> |
|
|
| colspan=2 {{n/a}} |
|
|- |
|
|- |
|
| ABAP Objects |
|
| ABAP Objects |
|
| rowspan=2 colspan=4 {{n/a}} |
|
| rowspan=2 colspan=4 {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| C++ |
|
|- |
|
|- |
|
| Objective-C (Cocoa) |
|
| Objective-C (Cocoa) |
Line 1,381: |
Line 1,393: |
|
| |
|
| |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>x'''.can("'''method'''")'''</code> |
|
| <code>x'''.can("'''method'''")'''</code> |
|
| <code>x'''.'''field'''.defined'''</code> |
|
| <code>x'''.'''field'''.defined'''</code> |
Line 1,391: |
Line 1,403: |
|
|- |
|
|- |
|
| JavaScript |
|
| JavaScript |
|
| <code>'''typeof '''x'''.'''method''' === "function"'''</code> |
|
| <code>'''] '''x'''.'''method''' === "function"'''</code> |
|
| <code>field '''in''' x</code> |
|
| <code>field '''in''' x</code> |
|
| |
|
| |
Line 1,421: |
Line 1,433: |
|
| |
|
| |
|
|- |
|
|- |
|
| C++ (STL) |
|
| APL (Dyalog) |
|
|
| <code>'''⎕THIS'''</code> |
|
|
| <code>'''⎕BASE'''</code> |
|
|
| <code>'''⎕NULL'''</code> |
|
|
| |
|
|
|- |
|
|
| C++ |
|
| <code>'''*this'''</code> |
|
| <code>'''*this'''</code> |
|
|<ref>C++ doesn't have a "super" keyword, because multiple inheritance is possible, and so it may be ambiguous which base class is referenced. Instead, the <code>BaseClassName::member</code> syntax can be used to access an overridden member in the specified base class. Microsoft Visual C++ provides a non-standard keyword "__super" for this purpose; but this is unsupported in other compilers.</ref> |
|
|<ref>C++ doesn't have a "super" keyword, because multiple inheritance is possible, and so it may be ambiguous which base class is referenced. Instead, the <code>BaseClassName::member</code> syntax can be used to access an overridden member in the specified base class. Microsoft Visual C++ provides a non-standard keyword "__super" for this purpose; but this is unsupported in other compilers.</ref> |
Line 1,480: |
Line 1,498: |
|
| <code>'''Nil'''</code> |
|
| <code>'''Nil'''</code> |
|
| |
|
| |
|
|
|
|
|- |
|
|- |
|
| Eiffel |
|
| Eiffel |
Line 1,500: |
Line 1,517: |
|
| |
|
| |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>'''self'''</code> |
|
| <code>'''self'''</code> |
|
| <code>'''SUPER'''</code> |
|
| <code>'''SUPER'''</code> |
Line 1,560: |
Line 1,577: |
|
| colspan=7 {{n/a}} |
|
| colspan=7 {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| APL (Dyalog) |
|
|
| <code>'''⍕'''x</code> |
|
|
| <code>'''⎕SRC''' x</code> |
|
|
| <code>'''⎕NS''' x</code> |
|
|
| <code>x '''=''' y</code> |
|
|
| colspan=2 {{n/a}} |
|
|
|- |
|
|
| C++ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| <code>x '''==''' y</code><ref>assuming that "x" and "y" are the objects (and not a pointer). Can be customized by overloading the object's <code>==</code> operator</ref> |
|
| <code>x '''==''' y</code><ref>assuming that "x" and "y" are the objects (and not pointers). Can be customized by overloading the object's <code>==</code> operator</ref> |
|
| |
|
| |
|
| |
|
| |
Line 1,686: |
Line 1,710: |
|
| <code>'''Scalar<wbr/>::Util<wbr/>::refaddr<wbr/>( '''$x''' )'''</code><ref>This example requires '''use'''ing '''Scalar::Util'''</ref> |
|
| <code>'''Scalar<wbr/>::Util<wbr/>::refaddr<wbr/>( '''$x''' )'''</code><ref>This example requires '''use'''ing '''Scalar::Util'''</ref> |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>'''~'''x</code><ref name="perl_string" /> |
|
| <code>'''~'''x</code><ref name="perl_string" /> |
|
| <code>x'''.perl'''</code> |
|
| <code>x'''.perl'''</code> |
Line 1,752: |
Line 1,776: |
|
| ?= |
|
| ?= |
|
|- |
|
|- |
|
| C++ (STL) |
|
| C++ |
|
| <code>''']('''x''')'''</code> |
|
| <code>''']('''x''')'''</code> |
|
| <code>''']<'''type''' *>(&'''x''') != ]'''</code> |
|
| <code>''']<'''type''' *>(&'''x''') != ]'''</code> |
|
| rowspan=8 {{n/a}}<ref name="implicit_cast">Upcasting is implicit in this language. A subtype instance can be used where a supertype is needed.</ref> |
|
| rowspan=8 {{n/a}}<ref name="implicit_cast">Upcasting is implicit in this language. A subtype instance can be used where a supertype is needed.</ref> |
|
| <code>''']<'''type'''*>('''ptr''')'''</code> |
|
| <code>''']<'''type'''*>('''ptr''')'''</code> |
Line 1,807: |
Line 1,831: |
|
| Visual Basic .NET |
|
| Visual Basic .NET |
|
| <code>x'''.GetType()'''</code> |
|
| <code>x'''.GetType()'''</code> |
|
| <code>'''TypeOf''' x '''Is''' type</code> |
|
| <code>''']''' x '''Is''' type</code> |
|
| {{n/a}}<ref name="implicit_cast"/> |
|
| {{n/a}}<ref name="implicit_cast"/> |
|
| <code>'''CType('''x''', '''type''')''' or '''TryCast('''x''', '''type''')'''</code> |
|
| <code>'''CType('''x''', '''type''')''' or '''TryCast('''x''', '''type''')'''</code> |
Line 1,838: |
Line 1,862: |
|
| <code>x'''->isa("'''class'''")'''</code> |
|
| <code>x'''->isa("'''class'''")'''</code> |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>x'''.WHAT'''</code> |
|
| <code>x'''.WHAT'''</code> |
|
| <code>x'''.isa('''class''')'''</code> |
|
| <code>x'''.isa('''class''')'''</code> |
Line 1,894: |
Line 1,918: |
|
| |
|
| |
|
|- |
|
|- |
|
| C++ (STL) |
|
| C++ |
|
| |
|
| |
|
| <code>'''using namespace''' ns''';'''</code> |
|
| <code>'''using namespace''' ns''';'''</code> |
Line 1,912: |
Line 1,936: |
|
| |
|
| |
|
| <code>'''import''' ns'''.*;'''</code> |
|
| <code>'''import''' ns'''.*;'''</code> |
|
| <code>'''import''' ns'''.'''item</code> |
|
| <code>'''import''' ns'''.'''item''';'''</code> |
|
|- |
|
|- |
|
| Objective-C |
|
| Objective-C |
Line 1,944: |
Line 1,968: |
|
| <code>'''use''' ns qw(item)''';'''</code> |
|
| <code>'''use''' ns qw(item)''';'''</code> |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| |
|
| |
|
| |
|
| |
Line 1,984: |
Line 2,008: |
|
| colspan=5 rowspan=2 {{n/a}} |
|
| colspan=5 rowspan=2 {{n/a}} |
|
|- |
|
|- |
|
| C++ (STL) |
|
| C++ |
|
|- |
|
|- |
|
| C# |
|
| C# |
Line 1,998: |
Line 2,022: |
|
|- |
|
|- |
|
| D |
|
| D |
|
| <code>f '''in { '''asserts''' } body{ '''instructions''' }'''</code> |
|
| <code>f <br />'''in { '''asserts''' } <br />body{ '''instructions''' }'''</code> |
|
| <code>f '''out ('''result''') { '''asserts''' } body{ '''instructions''' }'''</code> |
|
| <code>f <br />'''out ('''result''') { '''asserts''' } <br />body{ '''instructions''' }'''</code> |
|
| <code>'''assert('''expression''')'''</code> |
|
| <code>'''assert('''expression''')'''</code> |
|
| <code>'''invariant() { '''expression''' }'''</code> |
|
| <code>'''invariant() { '''expression''' }'''</code> |
Line 2,018: |
Line 2,042: |
|
| Perl |
|
| Perl |
|
|- |
|
|- |
|
| Perl 6 |
|
| Raku |
|
| <code>'''PRE {''' condition '''}'''</code> |
|
| <code>'''PRE {''' condition '''}'''</code> |
|
| <code>'''POST {''' condition '''}'''</code> |
|
| <code>'''POST {''' condition '''}'''</code> |