Thread overview
Hopefully not-too-obvious observation
Jul 18, 2013
Jerry
Jul 18, 2013
Simen Kjaeraas
Jul 19, 2013
Marco Leise
July 18, 2013
Hi folks,

I was looking at writing a hash-like class with a specific operator and disliking the syntax of:

T opBinary(string op)(U key) if (op == "in") {}

When it occurred to me that it could be simply tightened up as:

T opBinary(string op : "in")(U key) {}

Any thoughts?  Is this bad style?

Thanks
Jerry

July 18, 2013
On 2013-07-18, 04:50, Jerry wrote:

> Hi folks,
>
> I was looking at writing a hash-like class with a specific operator and
> disliking the syntax of:
>
> T opBinary(string op)(U key) if (op == "in") {}
>
> When it occurred to me that it could be simply tightened up as:
>
> T opBinary(string op : "in")(U key) {}
>
> Any thoughts?  Is this bad style?

It's how I write my operator overloads unless the function should match
several of them.

So no, I think it's good style. But that's just, like, my opinion, man.

--
 Simen
July 19, 2013
Am Wed, 17 Jul 2013 22:50:09 -0400
schrieb Jerry <jlquinn@optonline.net>:

> Hi folks,
> 
> I was looking at writing a hash-like class with a specific operator and disliking the syntax of:
> 
> T opBinary(string op)(U key) if (op == "in") {}
> 
> When it occurred to me that it could be simply tightened up as:
> 
> T opBinary(string op : "in")(U key) {}
> 
> Any thoughts?  Is this bad style?
> 
> Thanks
> Jerry

I write it like that, too. It's more readable with the "in" closer to the method name.

-- 
Marco