- Peer of Objective-C: objects are Objective-C objects, methods are Objective-C methods,
added to the runtime and indistinguishable from the outside.
"You can subclass UIViewController, or write a category on it."
The example is from the site, it was copied from an actual program. As you can see, interoperability with the C parts of Objective-C is still necessary, but not bothersome.
<void>alertView:alertView clickedButtonAtIndex:<int>buttonIndex self newGame. self view setNeedsDisplay.
- It has blocks:
This example was also copied from an actual small educational game that was ported over from Flash.
<void>deleteFile:filename thumbs := self thumbsView subviews. viewsToRemove := thumbs selectWhereValueForKey:'filename' isEqual:filename. aView := viewsToRemove firstObject. UIView animateWithDuration:0.4 animations: [ aView setAlpha: 0.0. ] completion: [ aView removeFromSuperview. UIView animateWithDuration: 0.2 animations: [ self thumbsView layoutSubviews. ] completion: [ 3 ]. ]. url := self urlForFile:aFilename. NSFileManager defaultManager removeItemAtURL:url error:nil. (self thumbsView afterDelay:0.4) setNeedsLayout.
You also get Higher Order Messaging, Polymorpic Identifiers etc.
- Works with the toolchain: this is a a little more tricky, but I've made some progress...part of that is an llvm based native compiler, part is tooling that enables some level of integration with Xcode, part is a separate toolset that has comparable or better capabilities.
Did you have a look? The part that is in Smalltalk is the distilled (but very simple) imposition algorithm shown here.
drawOutputPage:<int>pageNo isBackPage := (( pageNo / 2 ) intValue ) isEqual: (pageNo / 2 ). pages:=self pageMap objectAtIndex:pageNo. page1:=pages integerAtIndex:0. page2:=pages integerAtIndex:1. self drawPage:page1 andPage:page2 flipped:(self shouldFlipPage:pageNo). drawPage:<int>page1 andPage:<int>page2 flipped:<int>flipped drawingStream := self drawingStream. base := MPWPSMatrix matrixRotate:-90. drawingStream saveGraphicsState. flipped ifTrue: [ drawingStream concat:self flipMatrix ]. width := self inRect x. self drawPage:page1 transformedBy:(base matrixTranslatedBy: (width * -2) y:0). self drawPage:page2 transformedBy:(base matrixTranslatedBy: (width * -1) y:0). drawingStream restoreGraphicsState.
What this means is that any user of BookLightning could adapt it to suit their needs, though I am pretty sure that none have done so to this date. This is partly due to the fact that this imposition algorithm is too limited to allow for much variation, and partly due to the fact that the feature is well hidden and completely unexpected.
There are two ideas behind this:
- Open Source should be more about being able to tinker with well-made apps in useful ways, rather than downloading and compiling gargantuan and incomprehensible tarballs of C/C++ code.
- There is no hard distinction between programming and scripting. A higher level scripting/programming language would not just make developer's jobs easier, it could also enable the sort of tinkering and adaptation that Open Source should be about.