Meaning of Scoped! ??

Ron Tarrant rontarrant at gmail.com
Tue Jul 30 09:33:04 UTC 2019


Some things are almost impossible to research. For instance, in 
the GtkD wrapper code—specifically the Widget.d file—the 
following function definition appears:


	gulong addOnDraw(bool delegate(Scoped!Context, Widget) dlg, 
ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "draw", dlg, connectFlags ^ 
ConnectFlags.SWAPPED);
	}


With contemporary search engines, it's impossible to search for 
'!' and get meaningful results. And searching for 'Scoped!' 
results in every variation of the word 'scope' and ignores the 
'!' altogether, even with Google's Verbatim tool turned on. 
Worse, Google ignores case as well.

I also searched all three D-language books and found nothing.

Here are my questions:

1) What exactly does the '!' mean? For instance, '=' means "is 
equal to," but I don't know what words to 'think' while looking 
at a '!'

2) What does 'Scoped' mean?

3) In the specific instance above, what does 'Scoped!Context' 
mean as opposed to just 'Context'? In other words, what are the 
differences between 'Scoped!Context' and 'Context'?

The last question needs more explanation...

In Widget.d, there are two overloads of addOnDraw(), the one 
cited above and this one:


	deprecated gulong addOnDraw(bool delegate(Context, Widget) dlg, 
ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "draw", dlg, connectFlags ^ 
ConnectFlags.SWAPPED);
	}


The former works, but the latter spits out a 'deprecated' error 
(naturally).



More information about the Digitalmars-d-learn mailing list