Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8675657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:00:23+00:00 2026-06-12T20:00:23+00:00

Say we have this block: int (^aBlock)(BOOL) = ^(BOOL param) { … My current

  • 0

Say we have this block:

int (^aBlock)(BOOL) = ^(BOOL param) { ...

My current understanding of this is: the first int is the return type, (^aBlock)(BOOL) gives the name of the method and the type of its parameter, and = ^(BOOL param) is the parameter’s name inside the block … plus the parameter’s type again?

Why is the syntax such that we have to list the parameter type twice? Could the two types ever be different?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:00:23+00:00Added an answer on June 12, 2026 at 8:00 pm

    It is not quite “listing the parameter type twice”, you are in the first case declaring the type of a block variable, and in the second case you are defining a block literal.
    Then you are assigning the literal to the value of the variable. You could even do something like this, which is equivalent and better illustrates the fact that these are really two totally independent declarations, despite being associated with an assign statement:

    id thisBlock = ^id (id x, NSUInteger idx) {
        NSLog(@"x = %@",x);
        return x;
    };
    
    id (^thatBlock)(id obj, NSUInteger index) = thisBlock;
    

    The fact that they are independent of each other means it’s probably not even correct to attempt to provide some kind of transference or inheritance of typing information from the left hand side of the expression to the right. And yes, the types can be different – consider this code compiles and executes just fine:

    id (^thatBlock)(NSArray *, NSDictionary *, NSString *) = ^id (id x, id y, id z) {
        NSLog(@"x = %@",x);
        return x;
    };
    
    thatBlock(@[],@{},@"");
    

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say have this immutable record type: public class Record { public Record(int x,
Let's say I have cleaner like this .cleaner:after { content: '.'; display: block; clear:
Let's say that I have a block of code like this: keysPressed = new
Say I have this class: class myclass { public int Field1{ get; set; }
this is my first post so please show some understanding. I have some java
Say I have something silly like this: data SomeType = Unary Int | Associative
Say I have this: private list<myClass> myCollection; Is there a programming idiom to shorten
Say i have this this structure. MyApp ├── main.py └── package ├── __init__.py ├──
Say I have this table schema. ID AccNo Amount Say I have this data
Say I have this code - public interface ParentInterface1 { public List<? extends ChildInterface1>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.