Is @property implementable?

Bekenn leaveme at alone.com
Wed Mar 2 23:21:21 PST 2011


On 3/2/2011 9:21 PM, Jonathan M Davis wrote:
> Well, it wouldn't be universal then.

Agreed, and really, I don't have a problem with it being universal.  I'd 
prefer an annotation, but it's not that big a deal.  I'm just thinking 
of the following situation:



lib1.di:
	class Lib1Class
	{
		...
		version (2)
		{
			void bar();
		}
	}

lib2.di:
	import lib1;
	void bar(Lib1Class l1c);

main.d:
	import lib1;
	import lib2;

	void main()
	{
		Lib1Class foo;
		foo.bar();
	}


Through no fault of the caller or of lib2, foo.bar() goes from one 
completely valid meaning to another when lib1 is versioned.  Lib1 and 
lib2 could be from different authors, so lib1's author had no idea he'd 
just hijacked a function call.

With an annotation, the compiler could at least spit out a warning for 
lib2.di.  (I would be absolutely opposed to a warning for line 7 of 
main; that should be an unambiguous method call in version 2.)

Anyway, I'm just thinking out loud (erm, in text); I'm sure this has all 
been debated already.


More information about the Digitalmars-d mailing list