www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Methods require no parantheses

reply "Stian Pedersen" <stian.pedersen gmail.com> writes:
Why is this possible? Just had a bug because of it. Would be 
preferable that you have to state  property. From what I can see 
the  property is optional.

int main(string[] argv)
{
	int a()
	{
		return 1;
	}

	int b = a;

	return 0;
}
Apr 20 2012
next sibling parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> writes:
On 21-04-2012 05:26, Stian Pedersen wrote:
 Why is this possible? Just had a bug because of it. Would be preferable
 that you have to state  property. From what I can see the  property is
 optional.

 int main(string[] argv)
 {
 int a()
 {
 return 1;
 }

 int b = a;

 return 0;
 }
Just build with -property. -- - Alex
Apr 20 2012
prev sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday, April 21, 2012 05:26:21 Stian Pedersen wrote:
 Why is this possible? Just had a bug because of it. Would be
 preferable that you have to state  property. From what I can see
 the  property is optional.
 
 int main(string[] argv)
 {
 	int a()
 	{
 		return 1;
 	}
 
 	int b = a;
 
 	return 0;
 }
It predates property. Previously, there was no property, and pretty much any function which would qualify as a property function colud be called with or without parens. Eventually, only functions which are marked property will be able to be called without parens, and all functions with property will _have_ to be called without parens. But that's being phased in rather than being changed immediately and breaking a lot of existing code (it also gives the compiler the chance to get its property enforcement bugs ironed out). For now, if you compile with -property, that will enable strict property enforcement. Later, it will always be enforced, but not yet. - Jonathan M Davis
Apr 20 2012
parent "Stian Pedersen" <stian.pedersen gmail.com> writes:
Sounds good. Not always funny having to support backwards 
compatibility.
Apr 20 2012