Method chaining: Difference between revisions

Content deleted Content added
"method chaining" is not also called "named parameter". <ref>https://en.wikipedia.org/wiki/Named_parameter</ref>
No edit summary
Tags: Reverted Visual edit
Line 31:
A similar syntax is [[method cascading]], where after the method call the expression evaluates to the current object, not the [[return value]] of the method. Cascading can be implemented using method chaining by having the method return the [[this (computer programming)|current object itself]]. Cascading is a key technique in [[fluent interface]]s, and since chaining is widely implemented in object-oriented languages while cascading isn't, this form of "cascading-by-chaining by returning {{mono|this}}" is often referred to simply as "chaining". Both chaining and cascading come from the [[Smalltalk]] language.
 
WhileChaining chaining isin syntax, it has semantic consequencesimplications, namelyspecifically that requiresrequiring methods to return an object,. and ifWhen implementing cascading viathrough chaining, thisit mustis becrucial that the current object serves as the return object. This prevents the return value from being used for some other purpose, such as returning an [[error value]].
 
==Examples==