Wednesday, March 12, 2014

Objective-Smalltalk

Objective-Smalltalk:

Objective-Smalltalk is an evolution of Smalltalk based on the Objective-C runtime.

It adds angle brackets for type annotations, both for optional static type checking and to designate C types such as <int> or <double> for interoperating with C and Objective-C. Generic raw pointers are not supported, wrapper objects and bulk collections are preferred.

The other syntactic addition to Smalltalk is that identifiers are generalized to URIs. This addresses interoperability with the Unix filesystem and Web Resources, as well as subsuming Objective-C properties and Keyed Value Coding and making keyed storage such as dictionaries much less necessary and visible.

[…]

Objective-Smalltalk is built on top of the Objective-C runtime, as a peer to Objective-C, and uses the host platform’s C ABI and calling conventions, thus being fully integrated (e.g. callable) from other peers on the platform. It does not require a VM or an image.

Marcel Weiher:

While Objective-Smalltalk would not require shipping source code with your applications, due to the native compiler, it would certainly allow it, and in fact my own BookLightning imposition program has been shipping with part of its Objective-Smalltalk source hidden its Resources folder for about a decade or so.

[…]

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.

He also has some interesting comments on Hacker News.

Lots of good ideas here. I think a runtime-compatible Objective-C–without-the-C is where we are headed. But, and I hate to say this, I’ve never liked Smalltalk syntax. I like the way Smalltalk works, and I like the Objective-C bracket syntax, but to my eyes Smalltalk has too many spaces to be easily readable. I feel like I am forever parsing it and mentally inserting parens.

2 Comments

I have to admit I have the same problem with the too many spaces, and have come to prefer Objective-C's brackets to pure Smalltalk. However, I am hoping that Polymorphic Identifiers can mitigate this sufficiently, by making all "accessor" message sends go away, or rather turn into URLs that can be more easily parsed because they hang together at the lexical level.

Something that may help with the visual issue of 'too many spaces' is using a proportionally spaced font; all the Smalltalks I’ve used default to a proportional font for code. Note also that the Smalltalk standard is to use a space after colons, like in English, versus Objective-C which typically omits the space. (Because I learned Smalltalk before ObjC, my older code still puts a space there, but I don't do it for new stuff, particularly since it doesn’t play well with Xcode autocompletion.)

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment