Omissible Parentheses...

Chad J chadjoan at __spam.is.bad__gmail.com
Sun Aug 2 08:05:02 PDT 2009


Robert Jacques wrote:
> On Sun, 02 Aug 2009 09:06:29 -0400, Chad J
> <chadjoan at __spam.is.bad__gmail.com> wrote:
> 
>> Robert Jacques wrote:
>>>
>>> Nope. I meant _function_ chaining. This comment comes mostly from using
>>> std.string and std.algorithm, whose functions don't behave as fields.
>>> Both of these libraries show off the power you get from the flexibility
>>> of function call / property duality. I've also used toggle/flag setting
>>> methods in this way. It's concise, clean and very understandable.
>>>
>>
>> Interesting.  I don't think I've seen this angle yet.
>>
>> Could you provide code examples, please?
> 
> Here are two examples from a couple of days ago:
> 
> auto data = (cast(string)std.file.read(filename)).chomp.split;
> 
> set_colour.uses = (new Texture!float4(mod,"TRANSFER",
> tranfer_data)).normalize.clamp.linear;
> 
> I'd also point out 'uses' is overloaded with a variadic version:
> 
> CCK_engine.uses( iCCK, a_p, a_p2, a_t);
> 
> There were also a bunch of std.algorithm examples in the newsgroup back
> with the new phobos was launched. (Though this only works for arrays)

Thank you.



More information about the Digitalmars-d mailing list