I"m looking at the bullwinkle RPC utility to use it instead of our (chaotic) RPC handling mechanism. It’s a nice piece of code but I’d love to understand its intrinsics first. There a particular Squirrel construct I’m not sure how to interprete its behaviour. This resembles some newer C# constructs where you can pipe methods one after the other but not sure it is something similar. Can anyone shed some light ?
Thanks. That confirms what I thought… Never realised the ‘this’ keyword can be used in such a way. This opens up nice possibilities to write more beautiful and generic code…
And it is, essentially, identical to the same construct in C# (and in other languages*). It’s usually referred to as a “fluent” interface.
It’s not available in Erlang – there’s no ‘this’ to return, and Erlang doesn’t have a pipeline** operator, unfortunately
** This is the moral equivalent of returning this in functional, rather than OO, languages. For example, Elixir (look for the ‘|>’ operator) and F#. You can use the pipe operator in PowerShell to create fluent interfaces, too. For example, here’s one from my blog.
I come from a c# background, and I’m a big fan of fluent interfaces - I’ve been experimenting with this construct for a while with Aron and am a big fan!