Water 5-Method and Class-Method
method method.copy
Contract
Return typewob
Parameter keyDefault valueType
includereturn_truevar
limitopt
include_limittrueboolean
Parameter kindDefault valueType
Other unkeyed argumentsopt with ekind of expressionwob
Other keyed argumentsopt
Water Contract
<method method.copy
  include      =return_true
  limit        =opt
  include_limit=true
  _other_keyed =opt=wob=ekind.code="_add_to_environment"
  _other_unkeyed=opt=wob=ekind.expression="_body"/>
Creates (and returns) a new method that is the same as the _subject method. The new implementation should be put in the content of call to copy. It is common to use set immediately after copy to change or add additional fields.
<method foo bar=required> bar </>
<set new_foo = foo.<copy/>.<set bar=20/> />
<new_foo/>
20
Copying a method and changing its arguments is also known as currying.
<method foo bar=10> 
  "hello".<join bar/> 
 </>
<foo/>
"hello10"
<foo.<copy/>.<set bar=20 baz="aaa"/>/>
"hello20"
<foo.<copy> "bye" </> />"bye"
<foo/>"hello10"
<method foo bar=10> "hello".<join bar/> </method>.
  <copy/>.<set bar=20/>
<method _name_argument=foo_copy bar=20 "hello".<join bar/>/>