Kay had education in abstract algebra, cell biology(apparently).. he was fond of old varied computing arch (burroughs). So my point is, before reading his text, do yourself a favor, dig in the litterature deeply and broadly.
Kay had education in abstract algebra, cell biology(apparently).. he was fond of old varied computing arch (burroughs). So my point is, before reading his text, do yourself a favor, dig in the litterature deeply and broadly.
Took me about 5 long videos and some Google searches to get into his frame of reference, but it was well worth it. The amount of useful ideas I got out of his talks is absolutely astounding. He really changed the way I think about programming, computing, user interfaces and complex system design.
I am slowly watching through all of the videos from Kay I can find.
A good compilation to start with: http://vpri.org/talks.htm
You can also search Vimeo for more.
If you need a less abstract teaser before getting into the talks and "philosophy" part of the game, here's a demo of something called "Alternate Reality Kit"[2] back in 1986. Brace yourselves.
Programming and Scaling - Alan Kay https://www.youtube.com/watch?v=YyIQKBzIuBY
There's also one where he discusses anthropology and the human universals, but the title of that talk has escaped me for years. Anyone remember what that one's called?
(He has also been quite humble. He claims his own original ideas aren't very good and all the best stuff came from others. On Smalltalk, he also mentions Dan Ingalls did most of the work while Kay only did the mathematics.)
Or: OOP is what you get when you take the necessary programming model required at the software level, to get two hardware devices that don't trust each-other's engineering to successfully exchange data (like, say, a computer in a public library, and your smartphone that you've just plugged into it over USB), and then try to shrink it down as far as it'll go, while still retaining the ability to represent and handle every potential failure-mode of the original exchange.
Actors are overrated. Either you assume that any message may get lost, and you have to deal with failure, which is always painful. Or you assume the sender and receiver share a failure domain, and you're introducing asynchrony for no clear reason.
Alan Kay: A Personal Computer for Children of All Ages (1972) [pdf] http://www.vpri.org/pdf/hc_pers_comp_for_children.pdf
NB: Double check me on that -- is this the original unpublished one, or the revised one?
Smalltalk primitives and their classes are of necessity implemented outside of the language, they 'just work' and you can not inspect their implementation within the VM because that would require you to reflect on its own implementation, which it can not do for obvious reasons.
So even though Smalltalk is 'self aware' to an extreme degree that self awareness does not extend all the way to the bottom, and I don't see how that would be possible anyway. At some level you will have to make the jump between the CPU you'd like to have (the one executing Smalltalk directly) to the one that you actually have.
There is this guy: http://www.merlintec.com/lsi/jecel.html who has been working on a ST hardware implementation for a long time, I am not aware of its current status.
But note that even in that situation you will still be limited, but then not at the level of the VM builtins but at the level of the CPU instruction set implementing the primitives.
Ideally Smalltalk would be able to transcend the boundaries of the computer it runs on sending messages to other computers with proper error handling, that would be some kind of hybrid between the BEAM and the Smalltalk VM.
Information is quite sparse on that topic, and my knowledge is quite fuzzy there but I'd love to find more info on that (in case anyone can provide links.)
So with some exceptions, VM development occurs almost exclusively inside Smalltalk itself. In fact, this is how Alan Kay, Dan Ingalls, and others brought Squeak to life from an old Apple Smalltalk implementation. They touched C directly as minimally as possible and took the Smalltalk concept very seriously.
[1] http://pharo.gemtalksystems.com/book/Virtual-Machine/Buildin...
http://sdmeta.gforge.inria.fr/FreeBooks/BlueBook/
Instead of using Pascal or C, the code was written in a subset of Smalltalk-80 itself. This subset (later named Slang in the Squeak project in 1996) doesn't use objects nor polymorphism. It only deals with an Array of integers and only uses a few control structures, so every expression has a C equivalent.
The first VM implementers at Apple, DEC, Tektronix and HP manually translated this code into Pascal, assembly or C as their starting point and then evolved their code from there.
Much later it was shown that this code could actually run inside Smalltalk-80.
There is a follow up book called "Smalltalk-80: Bits of History, Words of Advice" that discusses some of those early VM implementations
1. use your own POSIX machine to cross-compile a POSIX ABI simulator for the target OS; and then
2. deploy a POSIX sandbox to the target, with POSIX tools like gcc inside, and continue work on things like the POSIX ABI simulator in there.
Note that in Self many of the implementation tricks needed to make Smalltalk run fast were eliminated. And I see no reason why the number of primitives can't be as few as 12 or so. The rest are needed either for speed (but a good compiler can let normal Smalltalk code do the same job) or to talk to the operating system (but a Smalltalk on "bare metal" doesn't need that).
objc_msgSend() is generally not the performance problem in Objective-C code, and the amount of stupid stuff done based on the misconception that it is is truly astounding. That includes CoreFoundation ("it's C, so it must be fast, oh but we need flexibility, so let's use a CFDictionary...") and Swift, which manages to be slower than Objective-C at just about everything.
And yes, I've done the measuring: http://www.mypearsonstore.com/bookstore/ios-and-macos-perfor...
Note the comparison to memory access. Nowadays, an actual memory access (that doesn't hit the caches) is more than an order of magnitude slower than a message-send. So if you can save a single DRAM access by performing 10 message-sends, you will come out ahead. So yes, the changes in hardware, particularly the relative changes have made a huge difference. For a lot of programs today, the stuff that comes between stalls waiting for DRAM is essentially free.
Also, Apple has continuously optimised objc_msgSend(), it is quite a beast these days.
Things that make Objective-C/Cocoa code slow are multitude, certainly the prevalence of NSDictionary (and CFDictionary) and other forms of keyed accessing, particularly because NSString, while a great implementation for user-facing Unicode strings, is extremely heavyweight for use as a symbol. Then there are call-return based APIs where streaming would be more appropriate (NSJSONSerialization/NSPropertyListSerailization) and the fact that APIs that look like they would be streaming (keyed archiving, swift coding) actually build NSDictionaries underneath). CoreFoundation was also quite the disaster, performance-wise (more than 2x regression compared to pre-CF Foundation), with Foundation itself also a significant regression, partly because it eliminated convenient collections for C types except bytes (NSData).
Integer or float arrays are trivial to add ( https://github.com/mpw/MPWFoundation/blob/master/Collections... ) and 100 - 1000x faster than NSArrays of NSNumbers. The binary property list format is capable of both random access (lazy loading...) and of directly encoding object graphs, but the APIs don't expose those capabilities.
Stepstone Objective-C had stack allocation for objects, this was eliminated by NeXT and not reinstated by Apple. So objects require heap allocation. Etc.
While I also agree that Objective-C was regarded as too slow compared to C++ in particular, that was never really true. Just as a small example, I did image processing in Objective-C, and yes, if you were to apply OO and message-sending on a per-pixel level, you'd be in a world of pain. But even at scan-line granularity, the overhead was already less than 1%, so in the noise. My Objective-C Postscript interpreter is faster than the Adobe interpreter (C-based last I checked) used by Apple at basic language-oriented tasks such as arithmetic/loops.
And of course, you wouldn't really want to use the OO part of Objective-C for operations on low-level C types such as or integers, the syntax is not really inviting compared to C for that sort of stuff. So I always thought that the hybrid nature (coarse-grain objects, connecting C-level implementations) worked really well, for both expressiveness and performance. The XML Parser example in the book shows how you can combine low-level C character processing with messaging-APIs to get both amazing performance (significantly faster than libxml2) and extremely convenient/powerful APIs. IMHO :-)
That's probably why the language was unceremoniously dropped by Apple - it's hard and unpleasant to reconcile these two worlds.
Btw, what is the perf problem then? Refcounting, boxing?
Couldn't disagree more. For the C types that tend to occur in bulk processing (bytes, integers, floating point numbers), C is great and Objective-C is...er...not so great ;-)
On the other hand, Objective-C is fantastic for hooking modules of these C-based data crunching methods together.
> Btw, what is the perf problem then? Refcounting, boxing?
Refcounting can be a problem, yes, but pre-ARC it was both much less so and pretty easy to avoid if you noticed it. Also the fact that NSObject and subclasses had no inline refcount, so went to an external hash-table for refcounting if it ever exceeded 1 (1 was implied by the object being alive).
More in the other answer, there isn't really "the" perf problem, there are various problematic implementations and habits promulgated by Apple, often without any good reasons.