Adding properties/members to base types?

Kirk McDonald kirklin.mcdonald at gmail.com
Wed Sep 5 11:08:43 PDT 2007


Steven Schveighoffer wrote:
> I must be going crazy, but I thought this behavior was implemented in D.
> 
> Is this just something someone proposed as an enhancement or is it real?
> 
> int myfunc(int x)
> {
>    return x + 5;
> }
> 
> int test()
> {
>   int m = 10;
>   return m.myfunc;  // implicitly knows that it should call myfunc(m)
> }
> 
> I can't find anywhere that this is mentioned, but I swear I read it 
> somewhere, either in a newsgroup post or the D specs.
> 
> -Steve 
> 
> 

This currently works only for the array types. It was proposed to 
generalize it for all types.

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org


More information about the Digitalmars-d-learn mailing list