Unknown closure syntax for processingQueue = { ... }()

What is the meaning of the syntax used in the processingQueue definition in the Concurrency chapter?

let processingQueue : OperationQueue = {
    ...
    return result
}()

According to the closure literature, it should be ok if the above declaration omitted the ending ‘()’. But can anyone clarify what the role of the parentheses is?

Declaring processingQueue without parentheses leads to this XCode error:

Cannot convert value of type '() -> _' to specified type 'OperationQueue'

Thanks in advance.

That’s not quite right.

The type of the following object is not OperationQueue but is function.

{
    ...
    return result
}

Try this:

print ({return "Jimmy Giggle"})

and you will see (function) printed.

() plays the role of the function invocation operator.

Now try this:

print ({return "Jimmy Giggle"}())

and you will see Jimmy Giggle printed.

Become a competent coder/programmer faster than you can imagine.

I see. Thank you for the clarification @ibex10 .