|
|
|
|
|
by todd8
3850 days ago
|
|
Grace's method names allow one to say: circle.at(x,y) radius(5) fill("solid")
where in Python one might say: circle.at(x,y, radius=5, fill="solid")
Objective C also allows multipart method names that help document the arguments.For you young whippersnappers, this idea goes back over half a century to Algol-60 where the commas that delimit parameters to functions can be optionally replaced by ") text: (". So our procedure call in Algol-60 could be written: draw(circle) at: (x,y) radius: (5) fill: (1.0)
or as: draw(circle, x, y, 5, 1.0)
|
|
What Grace does is based on this approach, but goes significantly beyond it in closing the gap further by allowing the parameter parts to be regular languages. So as a somewhat silly example you could have a single method that draws circles of the same size and fill at many different locations:
Depending on the definition of the method, the 'at:' part could be repeated 0-n times. It's pretty amazing.https://michael.homer.nz/Publications/DLS2015/paper.pdf