Carmack about static analysis

Chad J chadjoan at __spam.is.bad__gmail.com
Sun Dec 25 00:53:11 PST 2011


On 12/25/2011 02:57 AM, Kapps wrote:
> Universal Function Call Syntax. C# calls them extension methods.
> Basically, the ability to call a method directly on a class (in the form
> of A.MyMethod) without it being declared in the class. Usually just a
> static/global method that gets rewritten. Instead of MyMethod(A), you
> can use A.MyMethod.
> 
> On 25/12/2011 1:51 AM, Chad J wrote:
>> On 12/24/2011 10:37 PM, Kapps wrote:
>>> The two biggest things that I believe D would benefit from, in terms of
>>> readability, are UFCS and C#-style lambdas (which were already
>>> discussed).
>>>
>>> Something like
>>> 'array(find("test", select!("a.name")(filter!("a.num>  3")(Elements))))'
>>> Could be rewritten much cleaner as
>>> Elements.filter!"a.num>  3"
>>>      .select!"a.name"
>>>      .find("test")
>>>      .array();
>>>
>>> The first one is very confusing, hard to split across multiple lines
>>> without losing meaning, and difficult to see what it even operates on
>>> (assume Elements is not an array and thus can not be used with the
>>> current implementation of UFCS). The second one, you can clearly see
>>> operates on Elements, you can clearly split it across multiple lines,
>>> and it's very obvious where things stop and end. Plus, it eliminates at
>>> least one set of parenthesis per function call, not to mention being
>>> much easier to write as it's in order of steps instead of opposite
>>> order.
>>>
>>
>> Pardon, what does UFCS stand for?
> 

Ah good.

I always thought it a bit odd that we didn't have that.  Better yet if
it worked with operator overloading... then the operator overloads could
check for null.


More information about the Digitalmars-d mailing list