Garbage collection
New in F-Script 2.0 is a fast, concurrent, generational garbage collector. It was a lot of work to implement. Fortunately, Apple did all of it, as F-Script 2.0 uses the new Objective-C garbage collector. As with Objective-C, when you run F-Script in GC mode you no longer have to manage retain counts and to care for cyclic references. You can still use F-Script in non-GC mode, which is needed if you want to interact with non-GC capable frameworks or libraries. A new option in the F-Script preference panel let you choose your memory management model. Finally, you can embed F-Script in GC or non-GC applications.
Garbage collection is performed concurrently, on its own thread. Another notable aspect is that it works both for objects and for raw memory buffers. Actually, for raw memory buffers, you can either use managed or unmanaged memory. F-Script 2.0 lets you use unmanaged memory as usual (i.e., with the malloc: method) and introduces new methods, in the FSPointer class, for dealing with managed memory. Features such as weak references, explicit GC control, etc. are all available from F-Script using the standard methods provided by Cocoa.
64-bit
F-Script 2.0 provides 64-bit support. Benefits include:
- Very large virtual address space
- New Objective-C runtime (optimized message dispatching, zero-cost setup model for exceptions, etc.)
- Ability to load 64-bit frameworks in F-Script and to embed F-Script in 64-bit applications
You can still run in 32-bit mode and you can use the F-Script framework in 64-bit and 32-bit applications.
The F-Script API itself now exposes both 64-bit and 32-bit capable interfaces, using Cocoa’s NSInteger, NSUInteger and CGFloat macros.
New object browser
The graphical object browser gains a new look and a number of enhancements. This includes:
- Introspection of Objective-C 2.0 properties
- Improved introspection of bindings
- Direct access to the view hierarchy
- Visual feedback when selecting graphical components on screen
- Additional information about standards Cocoa objects
- And more…
Companion article: Exploring Cocoa with F-Script
Discover the graphical object browser and object inspectors in this in-depth article.
|
|
Dynamic Cocoa class creation
F-Script 2.0 makes it very easy to dynamically define new classes. At run-time, these dynamically generated classes are regular Cocoa classes that happen to execute F-Script code instead of compiled Objective-C code. They can be used from both F-Script and Objective-C. You can subclass existing Cocoa classes in F-Script and, as in Objective-C, define instance variables, instance methods and class methods. In addition, F-Script also supports defining class instance variables.
Companion article: Creating Cocoa Classes with F-Script
|
|
System-wide scripting
F-Script 2.0 is able to control scriptable applications and graphically browse and interact with the applications scripting interfaces. This major new feature is based on the MAC OS X Scripting Bridge technology. For example, here is how you can connect to iTunes:
iTunes := SBApplication applicationWithBundleIdentifier:'com.apple.iTunes'
You can then manipulate iTunes from F-script. For example, here is how you make iTunes go to the next track:
iTunes nextTrack
Companion article: System-wide Scripting with F-Script
Learn how to script your applications with this tutorial.
|
|
Updated embedding and injecting capabilities
F-Script can be easily embedded into your own applications or dynamically injected at runtime into any running Cocoa application. Embedding is great for adding scripting or interactive object querying/manipulation capabilities to your applications, as well as for implementing parts of your apps with F-Script. Injecting is incredibly powerful when it comes to debugging or exploring the innards of applications. F-Script 2 comes with full support for the new plugin model of Interface Builder 3, allowing drag and drop of F-Script graphical components right into your application. F-Script 2 also includes updated injecting tools (aka F-Script Anywhere) which lets you inject a complete F-Script environment at run time into any Cocoa application.
Companion article: Embedding F-Script into Cocoa Applications
|
|
Refined syntax and class library
F-Script is a Smalltalk dialect. As such, its syntax is well suited to the manipulation of Objective-C objects, since Objective-C itself borrowed its messaging syntax from Smalltalk. F-Script 2.0 introduces several syntax refinements, including a handy notation for specifying dictionaries. Here is how an NSMutableDictionary instance with two entries looks like:
#{key1 -> value1, key2 -> value2}
There are other syntax enhancements including support for Unicode in string literals and a hexadecimal notation for numbers. Besides, the base class library has been refined, with new methods for dealing with collections, new globals for easy access to the standards IO streams, a new facility for comparing objects with the special nil value and some changes in the way test for object equality is performed. It is also worth noting the introduction of a new public class, FSAssociation, which represents associations between two objects, a “key” and a “value”, and is primarily used for specifying dictionary entries.
If you are not familiar with the F-Script syntax and fundamental elements, the two articles referenced below will get you up to speed in a breeze.
Companion article: Learn F-Script in 20 Minutes and Have Fun Playing with Core Image
|
|
Companion article: Scripting Cocoa with F-Script
|
|
Snow Leopard
F-Script 2 is compatible with both Leopard and Snow Leopard. It lets you directly access a number of the latest Mac OS X frameworks. And other ones are just a simple loading instruction away.
Companion article: Accessing Mac OS X Frameworks with F-Script
|
|
New project infrastructure
The source code for F-Script is now available at Github.
New group for support and discussions: http://groups.google.com/group/f-script/.







Leave a Reply