3 ms·
It looks like "fluent interface" resembles "point-free" programming: https://en.wikipedia.org/wiki/Tacit_programming https://en.wikipedia.org/wiki/Tacit_progra
by kazinator 9y ago
It looks like "fluent interface" resembles "point-free" programming:
https://en.wikipedia.org/wiki/Tacit_programming https://en.wikipedia.org/wiki/Tacit_programming
However, there seems to be a key difference. Under "fluent interface", it looks like the object context is pointlessly being chained and the operations are just side-effecting on it, whereas "point free" programming implements a transformation pipeline by chaining side-effect-free operations.
E.g.
turtle.rotate(90).pen_down().forward(5);
Kind of thing which isn't a pipeline at all, and could be written:
turtle.rotate(90);
turtle.pen_down();
turtle.forward(5);
and arguably should.
- b2gills 9y agoI think using some sort of construct that topicallizes the object is a good middle ground between the two. For example this Perl 6 code: with turtle { # store in topic variable $_ (if it's defined) .rotate(90); # implicit method call on $_ .pen_down(); .forward(5); }