NSBlog
"A failure in the hot air department"
Showing entries tagged "blocks". Full blog index.
Friday Q&A 2011-11-11: Building a Memoizing Block Proxy
at 2011-11-11 16:06
Last time, I talked about my crazy hack that misuses the Objective-C message forwarding machinery to do block proxying. This allows writing code that interposes in front of an arbitrary block to intercept its arguments, manipulate its return value, etc. Today, I want to present an exanmple of using this hack which almost verges on the practical. Specifically, I'm going to discuss how to use it to build a generalized block memoization facility.
Friday Q&A 2011-10-28: Generic Block Proxying
at 2011-10-28 13:57
Here at Friday Q&A, I pride myself on occasionally taking my readers to places where normal people dare not tread. Today is one of those days. This is not a reader suggested topic, but today I want to talk about a fun hack I came up with that allows proxying block invocations in much the way that one can proxy Objective-C messages.
Friday Q&A 2011-06-03: Objective-C Blocks vs. C++0x Lambdas: Fight!
at 2011-06-03 15:11
Blocks are perhaps the most significant new language feature introduced by Apple in years, and I've written a lot about them before. The new C++ standard, C++0x, introduces lambdas, a similar feature. Today, I want to discuss the two features and how they are alike and how they differ, a topic suggested by David Dunham.
Friday Q&A 2011-05-06: A Tour of MABlockClosure
at 2011-05-06 17:34
It's a week late, but it's finally time for the latest edition of Friday Q&A. About a year ago, I wrote about converting blocks into function pointers by building code at runtime. This was an interesting exercise, but ultimately impractical due to various limitations. In the meantime, I wrote MABlockClosure, a more robust and usable way of doing the same thing, but I never posted about it. Landon Fuller suggest I discuss how it works, and so that is what I will talk about today.
Friday Q&A 2010-07-02: Background Timers
at 2010-07-02 16:45
Welcome back to another Friday Q&A. This week I'm departing from my usual user-driven format to present a class I've written for what I'm calling "background timers", and discuss potential uses for it.
Blocks and GCD in Russian
at 2010-06-29 15:22
Alexander Babaev has been kind enough to translate my series of posts on blocks and GCD into Russian for TouchDev.ru. So far he has posted two, Blocks in Objective-C and Intro to Grand Central Dispatch, Part I. Others in the series will be going up in the future. If you happen to speak Russian, check them out!
An Objective-C Continuations Library
at 2010-04-13 16:25
A couple of months ago I wrote about using Continuation Passing Style in Objective-C as an alternative technique for returning errors from methods. The major downside to that technique is that it integrates poorly with Cocoa, since Cocoa isn't written to use CPS. Jordan Breeding has spent the intervening time building up an impressive CPS adapter library which allows converting any Cocoa
NSError **
call into CPS style with virtually no work. Source code and extensive examples are available, and I encourage you to check it out.Friday Q&A 2010-03-05: Compound Futures
at 2010-03-05 13:53
Welcome back to another thrilling edition of Friday Q&A. This week I want to extend my discussion from last week about futures, and talk about compound futures, an extension to the basic futures system that I developed previously.
Friday Q&A 2010-02-26: Futures
at 2010-02-26 18:19
Welcome back to another shiny edition of Friday Q&A. Guy English suggested taking a look at implementing futures in Objective-C using blocks, and for this week's post I'm going to talk about the futures implementation that I built.
Friday Q&A 2010-02-12: Trampolining Blocks with Mutable Code
at 2010-02-12 18:20
Welcome to another edition of Friday Q&A, where deep technical talk and complete insanity combine! This week, I'm going to take a quick break from my usual reader-driven format and talk about a little toy I built earlier in the week, an adapter between blocks and more traditional function-pointer-based callback systems.
Friday Q&A 2010-02-05: Error Returns with Continuation Passing Style
at 2010-02-05 18:36
The Earth has moved 6.9 degrees around the Sun since my last post, which means it's time for another edition of Friday Q&A. This 6.9-degree segment, Guy English has suggested that I talk about the use of continuation passing style to simplify error returns in Objective-C code.
Friday Q&A 2009-10-16: Creating a Blocks-Based Object System
at 2009-10-16 15:50
It's Friday again, and that means another Friday Q&A. This week, Guy English proposed talking about a blocks-based object system, and that is what I will do. The system I've developed is a rudimentary system for doing object-oriented programming in pure C (plus blocks), and I'll discuss how it works and how to use it.
Friday Q&A 2009-08-14: Practical Blocks
at 2009-08-14 20:06
Welcome back to another edition of Friday Q&A. I'm back from my break and ready to bring you more programming goodies. This week I want to take Landon Fuller's suggestion to write a followup to my original Friday Q&A on blocks now that the design is finalized and code available for them.
Friday Q&A 2008-12-26
at 2008-12-26 17:19
Welcome to another Friday Q&A. This week I thought I would take fellow amoeboid Jeff Johnson's suggestion and talk about blocks in Objective-C.