Very nice, thanks! m.
On Jul 1, 2013, at 10:42 AM, John McCall wrote:
> On Jun 30, 2013, at 9:47 AM, Alex Zavatone wrote:
>> On Jun 29, 2013, at 12:20 PM, Matt Neuburg wrote:
>>> Yes, I looked at the spec and searched on the word "static" but I can't
>>> really understand what the spec is tell
On Jun 30, 2013, at 9:47 AM, Alex Zavatone wrote:
> On Jun 29, 2013, at 12:20 PM, Matt Neuburg wrote:
>> Yes, I looked at the spec and searched on the word "static" but I can't
>> really understand what the spec is telling me. Am I the only one who thinks
>> that this document has gotten more an
At 9:20 AM -0700 6/29/13, Matt Neuburg wrote:
On Jun 28, 2013, at 5:26 PM, Kyle Sluder wrote:
> On Fri, Jun 28, 2013, at 05:17 PM, Matt Neuburg wrote:
Why is the block permitted to assign to the variable sharedInstance
outside the block? Evidently it is because "static" has an effect like
"
On Jun 29, 2013, at 12:20 PM, Matt Neuburg wrote:
>
> Yes, I looked at the spec and searched on the word "static" but I can't
> really understand what the spec is telling me. Am I the only one who thinks
> that this document has gotten more and more obscure and abstruse over time?
So I'm not
That is *extremely* clear - thanks! m.
On Jun 29, 2013, at 9:42 AM, Jens Alfke wrote:
>
> On Jun 29, 2013, at 9:20 AM, Matt Neuburg wrote:
>
>> I'm trying to come up with a pithy explanation, suitable for beginners, of
>> why a "static" variable doesn't need a "__block" specifier in order fo
On Jun 29, 2013, at 10:00 AM, Kyle Sluder wrote:
> In the first case, the block context captured the _value_ of a. In the
> second, it captured the _pointer to b's movable storage_.
That's a nice example, because it also focuses on the *other* practical aspect
of __block, namely that it causes
On Sat, Jun 29, 2013, at 09:53 AM, Kyle Sluder wrote:
> Yes. In order to make it possible to capture local variables in a block,
> they are potentially hoisted to a storage that has the same lifetime as
> the block. For readonly accesses, that doesn't matter; the value of the
> expression is captur
On Sat, Jun 29, 2013, at 09:20 AM, Matt Neuburg wrote:
> I take it that the distinction we're drawing here is between static
> storage (which happens at file level and is therefore permanent)
Nitpick: static _storage_ doesn't have anything to do with the _file_.
The `static` keyword applied to a v
On Jun 29, 2013, at 9:20 AM, Matt Neuburg wrote:
> I'm trying to come up with a pithy explanation, suitable for beginners, of
> why a "static" variable doesn't need a "__block" specifier in order for a
> block to assign to it. The word "captured", as you suggest, may be useful
> here, since t
On Jun 28, 2013, at 5:26 PM, Kyle Sluder wrote:
> On Fri, Jun 28, 2013, at 05:17 PM, Matt Neuburg wrote:
>> Why is the block permitted to assign to the variable sharedInstance
>> outside the block? Evidently it is because "static" has an effect like
>> "__block", in that it makes the variable ou
On Fri, Jun 28, 2013, at 05:17 PM, Matt Neuburg wrote:
> Why is the block permitted to assign to the variable sharedInstance
> outside the block? Evidently it is because "static" has an effect like
> "__block", in that it makes the variable outside the block assignable.
> But how, exactly? Is it so
In this sort of well-known code pattern for making a singleton with GCD:
+ (MyClass *) sharedInstance {
static MyClass *sharedInstance = nil;
static dispatch_once_t onceToken = 0;
dispatch_once (&onceToken, ^{
sharedInstance = [MyClass new];
});
return sharedInstance;
}
12 matches
Mail list logo