Meaning of Scoped! ??

rikki cattermole rikki at cattermole.co.nz
Tue Jul 30 09:45:36 UTC 2019


On 30/07/2019 9:33 PM, Ron Tarrant wrote:
> 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 '!'
>

Template

https://dlang.org/spec/template.html

> 2) What does 'Scoped' mean?

Its a type defined by GtkD by the looks.

https://github.com/gtkd-developers/GtkD/blob/e14091fb2df4d05348061f274c131700af89fb16/generated/gtkd/glib/c/types.d#L56

> 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'?

Auto destruction of the argument and you cannot copy its value around.


More information about the Digitalmars-d-learn mailing list