For this week’s meeting, there will be two mini-presentations on F-Script and view-based animations in Core Animation. Source code and sample apps will be available afterwards. Read more…

A new episode of James Robertson’s Smalltalk for U series.

Ask F-Script

Vincent Gable on using F-Script for answering quick API questions instantly.

Thanks to the support of the good folks at the Mac Developer Network, the NSConference talk on F-Script 2.0 is now available for free. The session explores the need for interactive manipulation of objects and shows some of the cool graphical tools provided by F-Script to achieve it. Other new features in F-Script 2 are discussed, including dynamic Cocoa class creation, system wide scripting and the latest in exploring applications from the inside through run-time injection.

If you have never used F-Script and want to know what it is all about, this video should provide you with a good overview, packed with demos of interesting dynamic object-oriented technologies. If you are a regular F-Script user, you’ll feel at home but might still learn a few neat tricks.

You can watch the embedded video above or get to the video on its Vimeo page.


You can download F-Script 2.1 now (for Mac OS X 10.6 or later).

The main new feature in this version is support for adding methods to existing classes. This is similar to Objective-C categories, but works dynamically at run-time. This is quite useful for prototyping stuff and experimenting with new designs, as well as for making object-oriented frameworks developed independently work together. Besides, it is a natural extension of the ability to define Cocoa classes directly in F-Script and lets you write a bigger part of your application code in F-Script, should you want to.

You can teach new tricks to any class registered in the Objective-C runtime, regardless of its original implementation language (Objective-C, F-Script or other). The syntax is straightforward: class name followed by new methods inside a pair of curly braces. For example, here is how we can add a print method the NSObject class:

   - (void)print
       "Print the receiver's description on standard output."
       stdout print:self description

Of course, this also works for class methods. For example, the following code adds a pi method to the NSNumber class:

   + pi
       ^ 3.141592653589793

The following example, a little bit more sophisticated, adds some common Smalltalk collection methods (namely collect:, inject:into:, groupedBy: and select:) to the NSArray class:

   - collect:transformer
       "Answer a new NSArray constructed by gathering the results of
        evaluating transformer (a block with one parameter) with each 
        element of the receiver."

       ^ transformer value:@self

   - groupedBy:criteria
       "Answer an NSDictionary whose keys are the result of evaluating 
        criteria (a block with one parameter) for all elements in the
        collection, and the value for each key is the collection of 
        elements that evaluated to that key. For example
          {'Hello', 'guys', 'I', 'enjoy', 'programming', 'with', 'style'} 
        returns a dictionary with the following key/value associations:
           1 -> {'I'},
           4 -> {'guys', 'with'},
           5 -> {'hello', 'enjoy', 'style'},
          11 -> {'programming'}"

       | result |
       result := #{}.

       self do:[:each| 
           | key group |
           key := criteria value:each.
           group := result at:key.
           group == nil ifTrue:
               group := {}.
               result at:key put:group.
           group addObject:each.

       ^ result
   - inject:initialValue into:operation
       "Answer the final result of evaluating operation (a block with
        two parameters) using the previous evaluation result and each 
        element of the receiver as the parameters. The first evaluation
        of operation is performed with initialValue as the first 
        parameter, and the first element of the receiver as the second 
        parameter. For instance, to sum the numeric elements of an  
        array, use:
            anArray inject:0 into:#+"
       | nextValue |
       nextValue := initialValue.
       self do:[:each| 
           nextValue := operation value:nextValue value:each
       ^ nextValue

   - select:discriminator
       "Answer a new NSArray which contains the elements in the 
        receiver which cause discriminator (a block with one parameter)
        to evaluate to true. For each element of the receiver, 
        discriminator is evaluated with the element as the parameter. 
        Each element which causes discriminator to evaluate to true is 
        added to the new array."

       ^ self where:(discriminator value:@self)

Share and enjoy!

Michael Tyson’s Core Data Browser.app is a nifty tool which lets you easily open a Core Data database for graphical exploration with F-Script. You can read more about it in
Browsing Core Data databases using F-Script. I wonder where in Europe it has been developed…

In F-Script, blocks combined with message sending can be used to create new control structures fitting your needs (and mood!). Indeed, things like if/else, while or exception handling control structures are all provided at the library level, with no need for specialized syntax in the language itself. In F-Script Switching Options, Jeff explore creating new kinds of conditional control structures:

There are many ways to think through the flow of a program, and times when certain constructs like switch statements are a nice option, even in a language with no syntactical support for it, per se. Philippe Mougin was discussing just such options in F-Script back in the Oughts. I had a need for switching in F-Script, and came up with a few versions that I found useful. Read more…

I just got a copy of Objective-C 2.0 Guide de Survie, a book written by Pejvan Beigui and published by Pearson. This 240 pages pocket sized book looks great for french speaking people coming to Objective-C (and I can tell you there are a lot of them since Apple released an SDK for that phone whose name I’ve forgotten). The book is also aimed at current Objective-C developers transitioning to Objective-C 2.0 as there is a whole chapter dedicated to that subject.

Objective-C 2.0 in French

With this book, Pejvan comes back to its Cocoa roots. A number of french developers will remember him, as he has been very active in the early years of Mac OS X both as a member of Apple Developer Relations and as a founder of the Cocoa enthusiasts community Project:Omega (incidentally, he was the french translator for the original O’Reilly F-Script articles series). In the book, he makes approaching Objective-C 2.0 easier for people coming from other languages by often comparing its syntax and functionalities to those of Java and C# (with a little bit of Python too). He also puts emphasis on code quality, with advices on dealing with errors, assertions and unit tests.

I am starting to look for a new job. If you are reading this you probably know that I love working on innovative Cocoa-based stuff. Another field of interest for me is enterprise architecture: REST, SOA, JEE, ESB, etc. I am based in Paris, France, and you can get at my resume here. Interested?

F-Script injection brings amazing capabilities: it lets you explore applications from the inside, interactively navigating and manipulating the internal Objective-C objects they are made of. And it is all done live, while the applications are running. For example, if you haven't seen it yet, here is how the Finder looks like from the inside and here is a fun video clip showing how you can reprogram an application on the fly.

Since the dawn of times, F-Script injection was provided by F-Script Anywhere. But as you may know, Snow Leopard broke it without mercy. Fortunately, an alternative F-Script injection mechanism has been made available. Still, it requires launching gdb and typing a command, which is boring.

Today, I'm glad to announce that all of this is now entirely automated, thanks to the injection service developed by Silvio H. Ferreira. It adds an automated F-Script injection procedure in the Services menu, meaning that injecting a whole F-Script environment in an application is now just two mouse clicks away: one to go to the Services menu, and one to select the "Inject F-Script into application" item. This brings back the zero configuration and ease of use spirit of good old F-Script Anywhere.

Picture: injecting F-Script into the Finder using the new injection service
The revenge of F-Script anywhere

Once injected (which can take a few seconds), F-Script will make itself available by adding an F-Script menu in the menu bar of the target application.

You can download the F-Script injection service here (for Mac OS X 10.6).


Marketcircle, the maker of Daylite and Billings, is now an official sponsor of the F-Script project. Marketcircle is a big user of F-Script, which is integrated in Daylite and Billings and provides end-users with a lot of power and flexibility for advanced tasks such as creating sophisticated reports. Indeed, seeing how end-users directly make use of Smalltalk in the context of some of the most popular business applications on the Mac is quite nice.

By the way, if you are a Daylite or Billings user and are new to F-Script, there are a number of resources of should be aware of:

  • First, there is the must-read Daylite Reporting Fundamentals book by Eric O'Connell, which explores the report engine and introduces the usage of F-Script in that context. The book can also useful for Billings users, as it is based on the same report engine technology.
  • Second, there are the Marketcircle forums (including a scripting forum), where you can asks questions about F-Script in the context of Daylite or Billings.
  • You should also get your hand on the Daylite Developer Kit, which is full of relevant information and F-Script examples.
  • Of course, there is also the documentation available from the F-Script Web site, with a number of easy and fun tutorials to learn the language, and the F-Script Google group for questions and discussions.
  • Finally, you don't have to do everything by yourself. A vast network of Marketcircle partners is available, including a number of F-Script experts.

Restlet in Action

Lately, I've been helping Jerome Louvel and Thierry Boileau, the Restlet creators, in the writing of Restlet in Action. The first part of the book is now available in the early access program at Manning's. Restlet is a powerful Java framework for creating RESTful distributed systems. Not only does it target Web services, it also supports creating RESTful Web sites, addresses both the server sides and the client sides and has built-in support for the semantic Web. It can be used in a number of Java environments, including Java SE/EE, GWT, GAE (Google cloud computing platform) and even Android.

FSClass is a flexible and powerful block-based class creation and manipulation framework for F-Script 2.0. Jonathan Sterling is now implementing a similar framework for pure Objective-C:

I recently found an amazing bundle for F-Script called FSClass. FSClass allows you to mess with F-Script/Objective-C classes at runtime. […] Of course, this library can also be used from within Objective-C, but it isn't all that useful for most projects since the method blocks must be FSBlocks, coded in F-Script/Smalltalk. I wanted to write a similar system for pure Objective-C using normal blocks. And this is how I did it. Read more…

Nicholas Chen on making Objective-C land more habitable…

In early 2001, I wrote a white paper about Web Services and component models. At that time SOAP was all new and shiny and we were using it at Orchestra Networks to build the first version of the EBX platform. SOAP, and its usage as an RPC technology for the Web was one of the main subjects of the paper.

Shortly after publication, I got a short email from Mark Baker saying something like: «Sorry but your paper is completely uninteresting. RPC for the Web isn’t what you want» and pointing me at something mysterious called REST. I looked at REST and quickly added a new chapter about it, titled "RPC is not the only model". And from that time on, I’ve been happily doing consulting and teaching on REST, helping a number of people to get out of the SOAP/WS-* train wreck along the way. I did some writing too, including a white paper on architectural options for Web services (in french) and some contributions to the Restlet in Action book.

After all these years of fun and fascinating work with REST, I can say that Mark’s email is one of the most useful I ever got in my life. And I’m grateful for that.