News for hackers. Stuff that matters.
Re:“What Alan Kay Got Wrong About Objects” by bitwize on Sunday November 17, 2019 @02:51PM (#21559670)
Kay was at least as inspired by biological processes -- bacteria transmitting chemical signals to one another, for instance -- as he was by computer networks.

I think the big thing that Kay missed was asynchronicity. What Kay was thinking of when he coined the term "object oriented" -- rather than C++ -- was a sort of synchronous actor model in which the actor would always wait for a response after sending a message. This maps nicely onto function calls, but considerably more power can be had by letting the actor optionally continue doing stuff while awaiting a response. Bacteria continue to metabolize after sending chemical signals to their brethren after all!

As I've seen it said, Erlang is Smalltalk done right.

Re:“What Alan Kay Got Wrong About Objects” by jlokier on Sunday November 17, 2019 @10:59PM (#21561785)
This whole subthread about asynchronous objects, and the actor model, made me think of "background" processing where objects have a running life of their own, and it reminded me of a recent HN comment about almost the opposite approach, where nothing is allowed to be spawned off in the "background".

The author contends that Go's "go" (and indeed async blocks in a number of languages) which launch new concurrent objects which the parent block doesn't have to wait for, are a form of badly structured programming.

  https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/
  https://news.ycombinator.com/item?id=21537706
The structured concurrency described there reminds me of "par" blocks in some languages (Occam, Handel-C, XMOS XC), where each statement inside the block runs in parallel and the whole block waits until all statements inside have completed.

They do have asynchronous request/response patterns, but things can't be started and left to carry on running how they want, like you might think of bacteria.

Re:“What Alan Kay Got Wrong About Objects” by nurettin on Monday November 18, 2019 @04:26AM (#21562945)
The "structured concurrency" pattern, simply amounts to starting some async jobs (concurrent or parallel) and collecting all of them at the end of some context.

One antidote to unstructured concurrency is to use something like trio in order to make async job spawning a function of a context manager (called nursery in trio) so all job results will be collected when the nursery block ends.

Re:“What Alan Kay Got Wrong About Objects” by wwright on Monday November 18, 2019 @06:55AM (#21563579)
I believe the structured concurrency article is written by the author of Trio (I could be wrong.)
Re:“What Alan Kay Got Wrong About Objects” by dnautics on Sunday November 17, 2019 @03:30PM (#21559892)
If by "done right" you mean "the working programmer's smalltalk". Erlang and, probably even more by philosophy, Elixir, pushes you towards Kay's model, but the underlying BEAM gives you enough "cheats" to let you be incredibly productive. Especially in elixir those cheats are sufficiently ugly (as in code esthetics, nothing more) that you don't really want to use them unless you must, and when you do use them it's reasonably good practice wrap it in a macro so that the implementation details can be hidden away. In some cases where your using a non-kayish cheat (like it only helps to make your test parallelize over stateful services) you can make your macro no-op in prod.
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @04:38PM (#21560202)
The Actor Model has been used in many important large applications [Bonér and Reisz 2017, Cesarini 2019]. In order to implement next generation Reusable Scalable Intelligent Systems [Hewitt 2019], the following extensions to Erlang are needed:

* Automatically reclamation of storage of an unreachable future [Baker and Hewitt 1977] (e.g. process in Erlang). For example, an Erlang process can be orphaned if its Process Identifier becomes inaccessible.

* Language support for holes in the region of mutual exclusion of an Actor implementation. For example, in Erlang it is necessary for application programmers to explicitly code a message handler for each re-entry into the region of mutual exclusion potentially enabling cyberattacks from outside the process.

* Automatic cancellation of requests that have taken too long. For example, in Erlang it is necessary for application programmers to explicitly code a time-out for each message send that might take too long.

Re:“What Alan Kay Got Wrong About Objects” by dnautics on Monday November 18, 2019 @12:28AM (#21562126)
> an Erlang process can be orphaned if its Process Identifier becomes inaccessible.

Has this ever actually happened? Surely with as many deploys as erlang has, it would have been observed. A casual google search of "orphaned erlang process" shows the parent comment in the top four results, and no other results that mention orphaned erlang processes.

My point about erlang is that it's great precisely because, like all great systems, it doesn't dogmatically adhere to the academic design, and rather makes compromises and is refined by practitioners.

> re-entry into the region of mutual exclusion potentially enabling cyberattacks from outside the process

Typically you run your erlang actors inside of a trusted system. The only way to give untrusted actors access to your system, is explicitly (so no one does it). There are warning signs all over the place around every place where that might happen (for example distributed erlang) and in prod you really really shouldn't deploy distributed erlang without tons of security in depth in a deeply buried vLAN, or, TLS (instructions provided in the standard libs).

The only realistic vectors of attacks on your actor system is by compromising the entry points, like the actors which live to process your TCP or TLS entry points, but you can bet that ericcson has taken a lot of effort to harden those systems and, in fact, the ericcson SSL system was not vulnerable to the Heartbleed attack (despite using OpenSSL) because there are some very smart engineers at ericcson, and also the language generally doesn't have buffer overflows.

BTW, thanks for coming to my stanford ee380 talk a couple of Februaries ago -- unfortunately I wasn't aware of what you looked like, so I didn't get that you were in the audience at the time.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Monday November 18, 2019 @05:57PM (#21569042)
Erlang's insecurities will become more of a problem in the implementation of Reusable Scalable Intelligent Systems. See the following:

    https://papers.ssrn.com/abstract=3428114
PS. You are very welcome. Thanks for your EE380 talk!
Re:“What Alan Kay Got Wrong About Objects” by tines on Sunday November 17, 2019 @05:43PM (#21560518)
> For example, an Erlang process can be orphaned if its Process Identifier becomes inaccessible.

Determining this property of a program seems to me to be about as hard as the halting problem, since (1) an Erlang process can send its Pid to another process in a message, and (2) the VM/compiler can't tell a priori whether an erlang process will access its own Pid, or even send a message, in the future. I haven't read the paper you linked though, so I'm sure they found a way around this.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @06:00PM (#21560615)
We need a strongly typed version of Erlang so that garbage collector can tell when a future (i.e. process) inaccessible.
Re:“What Alan Kay Got Wrong About Objects” by thu2111 on Monday November 18, 2019 @05:10AM (#21563112)
It wasn't strongly typed exactly, but Microsoft's DCOM protocol featured a simple distributed garbage collector that would automatically unref objects and allow them to be deallocated in some cases. DCOM allowed processes to send handles to (relatively for the time) strongly typed interfaces for objects across the network, in a form of PID that was recognised on a LAN and could be resolved back to the original object in the original process. It was called an OXID (object exporter ID), if I recall correctly.

It's not well known but what we now call the actor model was pretty widespread in Windows programming in the 1990s. Partly because Visual Basic was like JavaScript: single threaded runtime, no shared memory. To aid developers in exploiting parallelism and using blocking APIs you could create parallel "workers" to use JS terminology (apartments in MS speak), but Windows gave you object oriented RPC between the workers. So it was an RPC layer on top of message passing. You could do asynchronous RPCs if you wanted to:

https://docs.microsoft.com/en-us/windows/win32/rpc/asynchron...

This was used to great effect in rather mundane programs like InstallShield, where the GUI ran in one worker and the install engine ran in an isolated (but in process) world, with the two communicating using RPCs/typed message passing.

Re:“What Alan Kay Got Wrong About Objects” by monoideism on Monday November 18, 2019 @01:18AM (#21562305)
That's what Pony was trying to do, but sadly it's lost most (all by now?) of its momentum.
Re:“What Alan Kay Got Wrong About Objects” by olodus on Monday November 18, 2019 @01:40AM (#21562374)
Yeah I do still check in with Pony from time to time and it is still puffin along but it has lost most of its momentum. Imo it went to far in the classes direction for its objects and started to have a too complicated syntax, while still missing making some parts clear and easy to get that imo needs to be very clear in the syntax of a high performant language. Things like if a thing you create needs to be allocated or not. I have several times thought about implementing something Pony / actor model -like in zig or something, but without all the classes stuff.
Re:“What Alan Kay Got Wrong About Objects” by macintux on Sunday November 17, 2019 @08:26PM (#21561236)
Do you feel it's possible to achieve that while retaining the hot code loading mechanisms and flexible message handling that allows distributed systems to process versioned, legacy messages?

Thanks for contributing to the thread, Professor Hewitt.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @11:42PM (#21561931)
Should be possible to achieve your goals. Researchers are working on prototypes.

You are very welcome!

Re:“What Alan Kay Got Wrong About Objects” by mercer on Monday November 18, 2019 @06:41PM (#21569318)
As a fan of Elixir, I'd love to hear Jose Valim, Chris McCord or any of the other core devs to chime in on this subthread!
Re:“What Alan Kay Got Wrong About Objects” by dnautics on Monday November 18, 2019 @01:40AM (#21562375)
I believe you're mistaken about this one:

> Automatic cancellation of requests that have taken too long. For example, in Erlang it is necessary for application programmers to explicitly code a time-out for each message send that might take too long.

https://hexdocs.pm/elixir/GenServer.html#call/3

> timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom :infinity to wait indefinitely. The default value is 5000. If no reply is received within the specified time, the function call fails and the caller exits.

Re:“What Alan Kay Got Wrong About Objects” by senderista on Monday November 18, 2019 @02:14AM (#21562483)
That's the gen_server functional interface, not the message send primitive (!).
Re:“What Alan Kay Got Wrong About Objects” by rkangel on Monday November 18, 2019 @08:17AM (#21564029)
That's OK. It doesn't matter at what abstraction layer the timeout is taken care of as long as it is taken care of. That it's in a library rather than the language core is an irrelevant distinction.
Re:“What Alan Kay Got Wrong About Objects” by strmpnk on Monday November 18, 2019 @09:24AM (#21564497)
It’s technically the receive primitive doing this using the after clause. The addition of unique references and selective receive then allows “call” style interactions to built (like gen_server).

Likewise, links and monitors are used for lifetime concerns instead of reference counting actors like Pony or using a global tracing collector. This has some advantages and disadvantages but for the most part I personally find it far more practical than other models which are more like the classic actor model.

Re:“What Alan Kay Got Wrong About Objects” by dnautics on Monday November 18, 2019 @05:14AM (#21563132)
Aha, thanks. I guess I'm not clear as to why an actor would care about the egress time of a message (unless it were waiting for a response)
Re:“What Alan Kay Got Wrong About Objects” by lidHanteyk on Sunday November 17, 2019 @07:20PM (#21561011)
Promise management features are coming to Monte soon, satisfying your first and third bullet points. The second point, of course, comes for free with E-style vats.
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @08:04PM (#21561157)
What is the precise definition of a "promise"?

I.e., what is the interface of a promise?

Re:“What Alan Kay Got Wrong About Objects” by lidHanteyk on Monday November 18, 2019 @08:42AM (#21564199)
Monte is based on E, so they are using E-style promises. An example of ActorScript in Monte is at [0].

There are two main operations that can be done with a promise. We can wait for it to complete, and then perform another action when it is complete, known as "when-blocks"; we can also send a message on top of another sent message, informally known as "promise pipelining".

When-blocks:

    when (action) -> { doMoreStuff() }
Promise pipelining:

    promise<-add(4)<-subtract(3)
[0] https://groups.google.com/forum/#!topic/cap-talk/y1bEqOoeswE
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Monday November 18, 2019 @10:30AM (#21565034)
Promises are used most prominently in current-generation JavaScript where they lack a proper interface. Instead promises are standardized using language constructs. Promises have the well-known disadvantage that promises are contagious, i.e, once a promise is used then everything that continues must be promises.

On the other hand, a Future [Baker and Hewitt 1977] has the following well defined interface:

   Future<t> *interface* resolve[] ↦ t
Re:“What Alan Kay Got Wrong About Objects” by Communitivity on Monday November 18, 2019 @08:02AM (#21563948)
The process id is not the only way to code the sending of a message in Erlang. You also can send a message to a named group if I remember right. Also, if you are using a supervisor tree (and for anything non-trivial you should), then the supervisor retains the process id. If that was not enough, as part of the Erlang runtime there is a process that handles binding and naming lookups, and it has the process id. Really don't see how this could happen.

I consider bullet 2 to be a feature of Erlang, not a bug. If a module implements a behavior you know it implements those functions, there's no checking needed. Yes, it increases your attack surface, but outside apps should not be messaging Erlang processes directly.

Bullet 3 seems like sugar. You can wrap the call in your own code that specifies a default timeout.

I'm not saying your concepts are wrong, they are interesting and a more complete/accurate Actor model implementation in Erlang could be a good thing. However, the points you specifically made about Erlang do not seem to me to be needed adds to the language.

Re:“What Alan Kay Got Wrong About Objects” by rkangel on Monday November 18, 2019 @08:14AM (#21564010)
> Bullet 3 seems like sugar. You can wrap the call in your own code that specifies a default timeout.

Which is exactly what GenServer does. You rarely need to directly send a message to an Erlang process - that is usually done under some abstraction providing the properties that you need.

Re:“What Alan Kay Got Wrong About Objects” by hota_mazi on Sunday November 17, 2019 @10:14PM (#21561632)
Not sure what apps you refer to in your two citations, one is probably just about Akka and not an app per se. And these two papers were written in the last two years.

There is still no credible evidence that the actors system is better than the more traditional way of writing distributed apps, especially now that more and more languages offer an increasing amount of asynchronous approaches.

Re:“What Alan Kay Got Wrong About Objects” by ebcode on Monday November 18, 2019 @02:48AM (#21562608)
I don't think there is a traditional way of writing distributed apps. The whole field is extremely young(/aka immature), and the ways are still being discovered. The actor model is just one way, but it lines up fairly nicely with what Joe Armstrong was doing with Erlang. I think they both deserve high marks.
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @11:28PM (#21561878)
To see if it is Actor, you have to check if it follows the rules. Akka and Erlang have been used to implement some important scalable systems.

What do you recommend as a "traditional" way to implement scalable systems?

Re:“What Alan Kay Got Wrong About Objects” by hota_mazi on Sunday November 17, 2019 @11:56PM (#21561992)
> Akka and Erlang have been used to implement some important scalable systems

Very few, really. Maybe you can come up with a few (besides the Ericsson router), but they are a tiny, tiny minority of how we build scalable systems today, and even if some systems are built this way, it's still no evidence that using Akka or Erlang was the best technology.

> What do you recommend as a "traditional" way to implement scalable systems?

I'm not recommending anything, I'm just observing that a crushing majority of scalable systems in use today, reliably serving billions of people and billions of API calls, are built on traditional, imperative technologies (C, C++, Java, C#, JavaScript, etc...).

This past decade, these services have been supplemented by increasingly powerful threading (thread pool, fork join, work stealing, etc...) and asynchronous (coroutines, promises, futures, channels, etc...) approaches.

The actor model has so far completely failed to prove itself as an improvement over these traditional approaches.

I also happen to think the actor model is terrible to debug, deeply violates encapsulation, and often forces developers to forego static typing, but that's more of a personal opinion than an observation.

Re:“What Alan Kay Got Wrong About Objects” by monoideism on Monday November 18, 2019 @01:25AM (#21562332)
> Very few, really. Maybe you can come up with a few (besides the Ericsson router), but they are a tiny, tiny minority of how we build scalable systems today,

Yeah, it's a small fraction because it's a rare language, but it's responsible for an outsized number of highly-scalable systems: WhatsApp, several massive ad companies, several massive trading systems, several large analytics companies. Plus most of the production XMPP systems that have been used at scale.

Look, I'm not even an Erlang/Elixir programmer, but it's pretty clearly a great technology for building scalable, fault-tolerant systems.

> I also happen to think the actor model is terrible to debug, deeply violates encapsulation, and often forces developers to forego static typing, but that's more of a personal opinion than an observation.

I mostly work in statically-typed functional programming languages at work, so I'm sympathetic to this complaint. But Erlang has the concept of fail-fast and fault tolerance that make the lack of type safety not as big of a deal as it normally would be.

Re:“What Alan Kay Got Wrong About Objects” by hota_mazi on Monday November 18, 2019 @01:47AM (#21562396)
It's very hard to know exactly how much of WhatsApp uses Erlang (there is hardly any documentation of that besides vague public release docs), and at the end of the day, like I said, just because a system is written with a technology doesn't mean it was the best idea.

> But Erlang has the concept of fail-fast and fault tolerance that make the lack of type safety not as big of a deal as it normally would be.

That "fail fast" / "let it crash" thing that Erlang brags about has never been convincing to me. First, because you still need to implement all these supervisors yourself anyway so the complexity is still there. Second, it's an admission that because of its lack of static typing, Erlang developers are just throwing their hands in the air and try to make pass what is a fundamental flaw in the language (that you can't effectively and exhaustively catch errors) as a strength.

Besides, Erlang doesn't have the monopoly on "let it crash": plenty of languages have better ways to catch and recover from errors, either through exceptions or algebraic data types that allow the compiler to make sure you have covered all the error cases.

Re:“What Alan Kay Got Wrong About Objects” by dnautics on Monday November 18, 2019 @05:20AM (#21563162)
> First, because you still need to implement all these supervisors yourself anyway so the complexity is still there.

Have you implemented an erlang/elixir supervisor? It's not hard. It would probably take me about 60 seconds.

> Besides, Erlang doesn't have the monopoly on "let it crash": plenty of languages have better ways to catch and recover from errors, either through exceptions or algebraic data types that allow the compiler to make sure you have covered all the error cases.

Simply handling the error is not the primary reason for "let it crash". The reason for let it crash is to have the remainder of the system continue to make forward progress and with minimal disruption.

I think if anything the greatest thing about let it crash is that I can have a relatively green junior put something into prod without worrying that an uncaught error will bring down the whole system.

Re:“What Alan Kay Got Wrong About Objects” by ramy_d on Sunday November 17, 2019 @06:01PM (#21560619)
for anyone else wondering what this dude is taking about https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3428114
Re:“What Alan Kay Got Wrong About Objects” by jghn on Sunday November 17, 2019 @06:24PM (#21560745)
“this dude” appears to be Carl Hewitt, creator of the actor model
Re:“What Alan Kay Got Wrong About Objects” by sriku on Monday November 18, 2019 @04:57AM (#21563068)
I didn't think that Kay's thinking was exactly the Smalltalk model. It is just that it was one feasible implementation with some key compromises thrown in. I don't think he missed asynchronicity. Just that the machines of his time would've made it next to impossible to be purist about that. He is smart enough to see that the biological systems he was inspired by are asynchronous. In other words, the synchronicity of Smalltalk is somewhat accidental, with good benefits reaped from the idea of reified messages, which Smalltalk does have and C++ etc. don't.

Erlang is indeed Smalltalk done right, but, as the OP wrote on the blog, it is not only about messaging and is about the additional constraints.

We've seen REST principles used within a single computer in the AppleScript system and protocol, for example, where you could think of applications running on a single computer as being individual computers in their own right and you need to be able to manipulate them using messages that talk using representations of objects in these applications. For example, "window 1" could be a representation for the first window in an application according to some internal ordering in it.

We also see REST-like interfaces at various system boundaries - for example, addressing textures on a GPU when preparing instructions on the host CPU. Databases too provide tables as resources and produce/consume representations of these tables to perform their functions. So it isn't surprising to see connectors to APIs exposed via ODBC or REST APIs to RDBMS tables as with PostgREST.

So the "InProcess-REST" is in principle understandable as an application architecture pattern, though with the caveat that I haven't gone into the specifics of the OP's work on this (expensive book, etc.).

Re:“What Alan Kay Got Wrong About Objects” by specialist on Monday November 18, 2019 @09:14AM (#21564422)
"REST principles used within a single computer in the AppleScript system and protocol"

In contrast to DLLs, shared data, COM+, ActiveX, plugins, and so forth.

Terrific observation. Thank you.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @04:47PM (#21560250)
In Logic Programming, Actors continue processing. See the following:

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3428114

Re:“What Alan Kay Got Wrong About Objects” by triska on Sunday November 17, 2019 @04:56PM (#21560290)
One very interesting development in this direction is Web Prolog by Torbjörn Lager:

https://github.com/Web-Prolog/swi-web-prolog/raw/master/book...

Quoting from the introduction:

"In particular, we pick the features that make Erlang into an actor programming language, and on top of these we define the concept of a pengine – a programming abstraction in the form of a special kind of actor which closely mirrors the behaviour of a Prolog top-level."

And quoting from Section 1.3 of the current draft:

"Is the actor programming model compatible with the logic programming model, and does the combination of the two models make sense? Yes, we will try to show that the actor programming model of Web Prolog is able to co-exist harmoniously with its logic programming model, and that both models are usable in the same program, with actors used for modelling the reactive, deterministic interfaces to the user and other external entities, and with the non-deterministic component behaving as an actor, encapsulating the non-determinism."

Chapter 3 cites your work directly:

"Actors, as specified in (Hewitt et al., 1973), involve entities that have their own mailbox."

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @08:35PM (#21561272)
Unfortunately, Actors cannot be efficiently implemented in browsers because of the way that they implement concurrency.
Re:“What Alan Kay Got Wrong About Objects” by bitwalker on Sunday November 17, 2019 @10:14PM (#21561628)
I’m not sure I agree. For example, nothing about Erlang makes it unsuitable for a browser environment, it can handle running single threaded, or distributed across workers, where each worker runs its own scheduler. The only limitation is interacting with the DOM, since that must all happen in the main thread, but it is still possible to treat that the same way other blocking I/O is dealt with in the scheduler.

I’m actually working on a compiler/runtime for Erlang for WebAssembly, so I’m maybe more familiar than most with how it works in practice.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @11:30PM (#21561888)
Workers can be made to work in a browser, but communication can be awkward and slow.
Re:“What Alan Kay Got Wrong About Objects” by monoideism on Monday November 18, 2019 @01:31AM (#21562352)
> Workers can be made to work in a browser, but communication can be awkward and slow.

True, but with the SharedMemory browser API, things are looking up (but not yet implemented in all major browsers).

Re:“What Alan Kay Got Wrong About Objects” by bitwalker on Friday November 22, 2019 @09:14PM (#21611972)
Apologies, Professor, I missed your reply!

SharedArrayBuffer makes communication between schedulers essentially equivalent to non-browser environments, but support for it is still iffy at best due to Spectre. Luckily, that is a temporary problem, not a fundamental issue (SharedArrayBuffer being disabled that is, not Spectre).

In a single-threaded setting, there isn't any significant overhead that I'm aware of between a browser and non-browser environment, aside from any overhead potentially incurred by executing on the WebAssembly VM rather than directly on the host machine. Of course, running single-threaded is less than ideal for other reasons.

Re:“What Alan Kay Got Wrong About Objects” by 7thaccount on Sunday November 17, 2019 @09:07PM (#21561388)
When you say "they", I assume you mean "browsers"? Sorry for the dumb question. I know precious little about web programming and concurrency.
Re:“What Alan Kay Got Wrong About Objects” by Izkata on Sunday November 17, 2019 @10:12PM (#21561619)
Except for webworkers (relatively new, I've not used them and know little about them), javascript in browsers is single-threaded. Even asynchronous things like ajax requests can only handle the result once the thread finishes doing whatever it was doing.
Re:“What Alan Kay Got Wrong About Objects” by 7thaccount on Monday November 18, 2019 @03:16AM (#21562692)
Interesting and thanks for the explanation. Does it have to be single threaded?
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Monday November 18, 2019 @06:28PM (#21569242)
JavaScript in browsers was decreed by the standards committee to be single-threaded forever. Consequently, JavaScript is entirely lacking in concurrency constructs, e.g., implementing a region of mutual exclusion inside a JavaScript program.
Re:“What Alan Kay Got Wrong About Objects” by 7thaccount on Tuesday November 19, 2019 @10:27AM (#21573829)
Thanks! I assume that was for a reason? Or just oversight?
Re:“What Alan Kay Got Wrong About Objects” by mpweiher on Sunday November 17, 2019 @02:56PM (#21559706)
As far as I can tell, synchronous operation was not a necessary component of his model, but a pragmatic implementation mechanism in order to make at least some of the vision usable.

If you look at the various histories, it seem like Smalltalk 76 was the point at which the system was made practical, and Smalltalk 80 was a refinement of that. Alan himself has repeatedly said that he was not very happy with that version.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @04:52PM (#21560269)
Message passing of Smalltalk-72 was quite complex [Kay 1975]. Code in the language was viewed by the interpreter as simply a stream of tokens. According to [Ingalls 1983]: "The first (token) encountered (in a program) was looked up in the dynamic context, to determine the receiver of the subsequent message. The name lookup began with the class dictionary of the current activation. Failing there, it moved to the sender of that activation and so on up the sender chain. When a binding was finally found for the token, its value became the receiver of a new message, and the interpreter activated the code for that object's class."

Thus the message passing model in Smalltalk-72 was closely tied to a particular machine model and programming language syntax that did not lend themselves to concurrency. SENDER was retained as part of the message-passing protocol, which is problematical for distributed systems. Also, although the system was bootstrapped on itself, the behavior of language constructs was defined (like Lisp) by an interpreter instead by their response to eval messages.

Re:“What Alan Kay Got Wrong About Objects” by mpweiher on Sunday November 17, 2019 @06:00PM (#21560616)
Well, and classes were "really" just sort of switch-statements matching that instruction stream, with the "methods" specific cases of that switch. All seems a bit distant from the conceptual model.
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Monday November 18, 2019 @06:02PM (#21569076)
The Actor conceptional model had not yet been developed when SmallTalk-72 was designed following on SmallTalk-71. Later versions of SmallTalk after SmallTalk-72 adopted the Simula object model. Actors were developed for concurrency, which was entirely lacking from Simula. Also, Simula had procedures attached to the class hierarchy instead of Actor message handlers, which initially seemed like a subtle distinction that grew in importance.
Re:“What Alan Kay Got Wrong About Objects” by macintux on Sunday November 17, 2019 @02:54PM (#21559690)
I love Erlang; it would be fascinating (and an astronomical level of effort) to create an Erlang environment with the same powerful UX as Smalltalk.
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @08:25PM (#21561231)
Yes, Erlang dearly needs an IDE comparable to the one for Java Studio.
Re:“What Alan Kay Got Wrong About Objects” by dnautics on Monday November 18, 2019 @01:14AM (#21562290)
Programming in elixir with vscode and elixir-ls is a fantastic experience.
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Monday November 18, 2019 @06:36PM (#21569293)
Visual Studio Code and and Elixir with Language Server Protocol are are good start but still have a long way to go reach the level of Android Studio with plugins.
Re:“What Alan Kay Got Wrong About Objects” by mercer on Monday November 18, 2019 @06:44PM (#21569343)
could you elaborate? I've never worked with Android Studio...
Re:“What Alan Kay Got Wrong About Objects” by senderista on Monday November 18, 2019 @02:05AM (#21562452)
I agree that message-passing should be asynchronous by default, but I disagree that message-passing "maps nicely" onto procedure calls in general. Only a particular subset of procedure calls can be naturally interpreted as message-passing: those with a distinguished receiver. Many mathematical functions lack such a distinguished argument, and Smalltalk and other OOP languages are unnecessarily awkward by forcing them to have one. IMO Erlang got it right by keeping a separate notion of function that doesn't involve message-passing.
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Monday November 18, 2019 @06:31PM (#21569264)
Actor message passing "maps nicely" for use in procedure calls. For example Factor.[3] sends the message [3] to Factorial which sends back the return value 6. The procedural functions of Erlang are much more limited.
Re:“What Alan Kay Got Wrong About Objects” by senderista on Monday November 18, 2019 @07:06PM (#21569484)
Sure, if functions are modeled as Actors. But I don't see the point of modeling the evaluation of a total mathematical function as asynchronous message passing (other than theoretical minimalism).
Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Tuesday November 19, 2019 @12:52AM (#21570922)
An Actor procedure need not be a mathematical function. For example, Random.[ ] could return a different result each time that it is invoked.
Re:“What Alan Kay Got Wrong About Objects” by orthoxerox on Sunday November 17, 2019 @02:59PM (#21559730)
The earliest Smalltalk versions used actor-like communication, but then Alan Kay learned about Simula and was seduced by the promise of straightforward low-overhead implementation.
Re:“What Alan Kay Got Wrong About Objects” by alankay on Sunday November 17, 2019 @07:19PM (#21561008)
This is a quite inaccurate comment. The catalysts (in 1966) for the ideas I had included Sketchpad (especially), Simula I (a few days later), the ARPAnet (under discussion), operating systems inter-process communications (especially Project Genie), the Burroughs B5000, my old biology and mathematics majors. All these are mentioned in "The Early History of Smalltalk" that I wrote for the ACM History of Programming Languages"

Actors appeared after I gave a talk at MIT about the very first Smalltalk.

There were several later ideas that were discussed at Parc but not taken up because of the whirl that was already going on. One of these was derived from McCarthy's "fluents" and "situations" (essentially a labeled states/layers idea for allowing concurrencies without race conditions -- this was done very well in David Reed's 1978 MIT thesis.

Another was not waiting for replies. This was in the original set of ideas -- via biology and OS techniques -- but never got implemented in a deep way. The hardware we had at Parc was tiny and Smalltalk was expressive enough to fit a lot into a little.

Another set of ideas that were completely missed appeared in LINDA by Gelernter. This (and the larger ideas around it) are very good ways to deal with larger scalings, etc.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @08:15PM (#21561197)
Actors were developed to synthesize and integrate a whole bunch of things including those mentioned by Alan above.

Additional important influences in addition to SmallTalk-72 [Kay November 1972] were Petri nets, Planner [Hewitt 1969], capability systems [Dennis and van Horn], semaphores [Dijkstra], the lambda calculus, and Scott-Strachey semantics failure to integrate everything using the lambda calculus.

1-way message passing is most important for hardware systems in which there is near certainty that a message will be delivered and there is no need to wait for an acknowledgement of receipt.

Re:“What Alan Kay Got Wrong About Objects” by kragen on Sunday November 17, 2019 @11:44PM (#21561952)
Thanks for correcting the record. I've read your HOPL paper but didn't remember.
Re:“What Alan Kay Got Wrong About Objects” by alankay on Thursday November 21, 2019 @07:09AM (#21593311)
In the HOPL paper is some discussion of the first design for Smalltalk, that I was working on when "the bet" happened and brought Smalltalk-72 to life as the answer to "the bet" (it used a combination of Lisp and Meta II techniques to win the bet). This made it quite easy to implement, and once Dan Ingalls implemented it, we started using it.

Smalltalk-71 was never implemented (and never had its design finshed, so there is less that can be claimed about it). But, germane to this discussion, I really liked Carl Hewitt's PLANNER language, and the entire approach to "pattern directed invocation" as he called it -- this was kind of a superset of the later Prolog, and likely influenced Prolog quite a bit.

The PLANNER ideas could be used as the communications part of an object oriented language, and I thought this would be powerful in general, and also could make a big difference in what children could implement in terms of "reasoning systems" (not just imperative action systems).

For Smalltalk-72 I used a much more programmatic approach (Meta II) to recognize messages (that also allowed new syntax/languages to be defined as object protocols (to win the bet) but this was not done comprehensively enough to really use what was great about PLANNER.

There were a few subsequent attempts to combine objects with reasoning, but none of them that I'm aware of were done with end-users in mind.

I thought the subsequent ACTOR work by Carl and his colleagues produced really important theoretical results and designs, most of which we couldn't pragmatically use in the personal computing and interface work on the rather small Xerox Parc personal computers.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @04:43PM (#21560228)
Re:“What Alan Kay Got Wrong About Objects” by edejong on Sunday November 17, 2019 @05:27PM (#21560438)
Seduced sounds like it had a viable alternative. At the time, machines were mostly single-threaded, especially in the learning environment he was trying to conceive. In that case, there is no need for actor-like communication, except for mindset of it.
Re:“What Alan Kay Got Wrong About Objects” by esfandia on Sunday November 17, 2019 @05:39PM (#21560496)
Actalk [1] provided actor-like asynchronous communication on top of Smalltalk.

[1] Briot, Jean-Pierre. “Actalk: A Testbed for Classifying and Designing Actor Languages in the Smalltalk-80 Environment.” ECOOP (1989).

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Sunday November 17, 2019 @08:23PM (#21561225)
Actalk was a useful early simulation. However, it did not provide a region of mutual exclusion for an Actor with facets.

See the following: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3418003

Re:“What Alan Kay Got Wrong About Objects” by smabie on Monday November 18, 2019 @07:39AM (#21563830)
I’ve never used Erlang but have shipped production Akka+Scala systems and let me tell you, it’s hard. A big part of the problem is that Akka only supports cooperative multi-tasking: No blocking operations allowed (unless you pin the actor to a thread). This causes a big problem with the code: all implicit state must be made explicit. This creates a lot of boilerplate and makes some problems very difficult, especially with regards to TCP/UDP connections. Even with Erlang that doesn’t have these problems, debugging and writing actor systems are some of the hardest programming problems I’ve ever come across.

Also actor systems are fundamentally stateful and don’t mesh well with FP. Are they better than threads? Of course, but it’s a low bar. Hopefully some abstraction will be discovered that offer significant improvement over actors, but I wouldn’t hold my breath. Stuff like futures are great and can solve some problem, but are not general enough to replace actors or threads.

Re:“What Alan Kay Got Wrong About Objects” by diroussel on Monday November 18, 2019 @08:04AM (#21563957)
Could you imagine a layer that compiles down to actors? If that it too much of a stretch maybe something that can lint the protocol flows between actors. So you can have proof that fragmentation and re-assembly is done correctly. Or that message sizes are bounded. Or some other higher level property is proven true?
Re:“What Alan Kay Got Wrong About Objects” by smabie on Monday November 18, 2019 @09:20AM (#21564461)
One thing I’ve thought of is that instead of messages, each actor exports a list of functions that it provides. Then other actors can call these functions and everything looks synchronous but under the hood each actor is calling other actors functions transparently. This would eliminate message bloat (too many kinds of messages) and would end up looking kind of like OO. So instead of sending the message: Sum(x, y) and eventually getting the response: SumReturn(x), I could just do something like: actorA.sum(x, y) that would look and act like a regular function call. Then actorA could implement sum like:

def sum(x: DbInt, y: DbInt) = DbActor.get(x) + DbActor.get(y)

With Akka, none of this is possible. Once actorA received the Sum message, first it would have to send the Get messages to DbObject and update some record indicating I’m waiting for two Get responses while also saving who I’m supposed to send the data to. Then I need to have a big match statement and update the record whenever I get that specific response. Once I finally have received the two responses, I look up where to send my message, and then finally send my SumReturn() message.

It’s a total nightmare and it sucks big-time. A lot of Akka code just ends up being maintaining these large dictionaries keeping track of all the unfinished stuff I eventually need to send various actors when I finally receive all the ingredients.

And it starts to get really bad when you have hierarchical actor structure and one of the terminal actors needs some information held by the top nodes. Then I either need to forward the message up one by one maintaining state along the way, or find the parent of the parent of the parent and send the message directly. And if I do that, now my root actors are talking to everyone else, and the information partitioning advantages of the hierarchy are broken.

There’s one actor topology that really shines though: directed acyclic graphs. If I only send information one way, like a waterfall, actors work really really well. Great for bioinformatics or other ML/data science pipelines.

Re:“What Alan Kay Got Wrong About Objects” by davedx on Friday November 22, 2019 @07:04AM (#21604815)
> A lot of Akka code just ends up being maintaining these large dictionaries keeping track of all the unfinished stuff I eventually need to send various actors when I finally receive all the ingredients.

I don't think this is an Akka-specific thing. I work with NServiceBus, which implements long running processes using database-persisted sagas (sort of state machines), and we have exactly the same situation... NServiceBus even makes these big state-tracking dictionaries explicit (every saga has a corresponding "saga data" object).

Re:“What Alan Kay Got Wrong About Objects” by raghava on Monday November 18, 2019 @09:39AM (#21564603)
>> As I've seen it said, Erlang is Smalltalk done right.

I was just listening to this today morning, where I heard Joe mention in the podcast something similar on those lines (though I believe he even mentioned about prolog+concurrency was wat led to Erlang and Plex)

https://softwareengineeringdaily.com/2015/11/02/erlang-with-...

Re:“What Alan Kay Got Wrong About Objects” by mistrial9 on Sunday November 17, 2019 @06:33PM (#21560792)
I assert that the mental model held by the programmer, reducing complexity and making effective toolbox choices, is a significant benefit, too.
Re:“What Alan Kay Got Wrong About Objects” by 0xcde4c3db on Monday November 18, 2019 @09:22AM (#21564476)
It's not precisely the same distinction, but this reminds me of a CS professor who talked about "blocking send" and "non-blocking send" message systems. He wasted no time in abbreviating them to "BS" and "non-BS".
Re:“What Alan Kay Got Wrong About Objects” by bad_user on Monday November 18, 2019 @08:53AM (#21564271)
> Erlang is Smalltalk done right

I disagree ...

In the Erlang model the messages are no longer just function calls with single dispatch. Imagine for example that method calls on String values would be asynchronous actor messages. That would be absolutely awful.

OOP isn't just about the actor model. OOP is also about encapsulation and polymorphism. In a static language, we're talking about row or subtyping polymorphism, i.e. methods of "ad hoc polymorphism".

And polymorphism and encapsulation transcend the actor model. I actually really hate the actor model, because asynchrony makes everything harder and actors are too low level, whereas OOP in general is passable as a paradigm in the right context.

Re:“What Alan Kay Got Wrong About Objects” by matheusmoreira on Monday November 18, 2019 @03:21AM (#21562716)
> This maps nicely onto function calls, but considerably more power can be had by letting the actor optionally continue doing stuff while awaiting a response.

> Bacteria continue to metabolize after sending chemical signals to their brethren after all!

I absolutely love the metabolism metaphor but it doesn't map directly to computer programs as we write them today.

Metabolic pathways form an intricate system:

https://upload.wikimedia.org/wikipedia/commons/a/a8/Human_Me...

Glycolysis, for example: starting from glucose at the top, we can follow its decomposition in the cell all the way to the mitochondrion.

This is similar to Unix pipelines. However, on Unix we must manually construct the pipeline:

  find ~/notes | grep TODO
In a metabolism-like system, the mere existence of these programs would be enough to provoke computation. I'd write "~/notes" somewhere and the find and grep programs would somehow know the data was meant for them and automatically execute themselves.

Enzymes are analogous to programs running in parallel. They are completely independent and don't interface directly with each other. They implement a process just like functions do. However, they don't explicitly call upon each other to perform a task.

Substrates and products are analogous to data of highly specific types. Catalysis occurs when substrate and enzyme come close enough to interact. The enzyme takes the substrate from a shared environment and releases the product into the same environment where the process repeats with other enzymes. This environment is most commonly the cytoplasm.

Enzymes determine whether their substrates are compatible by their chemical structure. This points towards structural typing. When glucokinase phosphorylates glucose, it becomes a different substrate: glucose 6-phosphate. Likewise, when a function adds a property to an object, it's structure changes and so does its type.

For example, let's take the following functions:

  f : A -> B
  g : B -> C
  h : C -> D
In a metabolic system, there is no need to explicitly write code like:

  a = A(input())
  h(g(f(a)))
Rather, they would immediately consume values of type A when they enter the system and the output would be a value of type D in the environment. The computer would fully metabolize data whenever it becomes available and go idle afterwards. As if the programming language's virtual machine was constantly processing all objects in the system:

  for object in objects:
    for function in functions:
      if function.argument.type == object.type:
        result = function(object)
        objects.add(result)
        objects.remove(object)
        break
It would be like polymerase chain reaction: throw DNA polymerase, nucleotides, some ions, the target DNA and its matching primers in a reaction tube, heat it up in a thermal cycler and the copying will begin happen because all the pieces are in place.
Re:“What Alan Kay Got Wrong About Objects” by imode on Sunday November 17, 2019 @03:11PM (#21559789)
What's interesting is that there's no "destination" for these chemical signals, they're just emitted into the void. There's no sense of sender/receiver, which has some correspondence to the blackboard model[1,2].

1. https://en.wikipedia.org/wiki/Blackboard_system 2. https://en.wikipedia.org/wiki/Blackboard_(design_pattern)

Re:“What Alan Kay Got Wrong About Objects” by chongli on Sunday November 17, 2019 @03:20PM (#21559841)
Yeah, exactly. The synchronous, one-to-one method calls of C++ or Java bare basically no resemblance at all to bacteria chemical signals. The former are essentially functions which dispatch on the first parameter.

The blackboard model isn't quite accurate though. Chemical signals have spatial locality, propagation delay, and half-lives. An asynchronous, peer-to-peer mesh network of actors would be a closer approximation to the bacterial signal model.

Re:“What Alan Kay Got Wrong About Objects” by imode on Sunday November 17, 2019 @04:58PM (#21560299)
Something like a "place-based" tuple space would be more accurate, yeah.
Re:“What Alan Kay Got Wrong About Objects” by GuiA on Sunday November 17, 2019 @05:01PM (#21560310)
See also: membrane computing/P systems

https://en.wikipedia.org/wiki/P_system

Re:“What Alan Kay Got Wrong About Objects” by edejong on Sunday November 17, 2019 @05:40PM (#21560498)
The original ideas behind Smalltalk did allow a void, as in modern day Kafka would be a void or a multi-cast IP address would be a void. There is no clear receiver, there can be multiple receivers or there can be none. Communication is ephemeral. Also, even with the single dispatch system of Smalltalk, we can easily model something similar to the Blackboard system.
Re:“What Alan Kay Got Wrong About Objects” by agumonkey on Sunday November 17, 2019 @03:14PM (#21559808)
Maybe not directly but I'm sure these organisms has knowledge of context which influence hormone release. I'd be surprised if it was totally or near totally blind.
Re:“What Alan Kay Got Wrong About Objects” by dragonwriter on Sunday November 17, 2019 @03:45PM (#21559963)
> As I've seen it said, Erlang is Smalltalk done right.

As I see it, It's not, but it’d be a decent platform to build an asynchronous smalltalk on top of. One key thing it is missing is a convenient syntax for defining processes (either via instantiable templates equivalent to “class” in many OOPLs or as singletons equivalent to “object” in Scala) in terms of the message handlers and local state (volatile state of the kind that would be held in the process dictionary and the kind of “transactionally updated” state that, in Erlang, would be carried in function args.)

Re:“What Alan Kay Got Wrong About Objects” by cuddlecake on Monday November 18, 2019 @02:31AM (#21562547)
A process is simply a function that runs independent of other functions in the system + a mailbox + a handle + own memory.

So the convenient Syntax to define a process is a function declaration. Plus, calling "spawn" to start the process.

Of course, as other responders pointed out, there is also OTP, an established framework (not syntax) to define processes with predefined, battle-tested behaviours.

Re:“What Alan Kay Got Wrong About Objects” by ProfHewitt on Monday November 18, 2019 @11:09AM (#21565397)
The Actor Model attempts to be as general as possible to support direct modeling and efficient implementation of all digital computation. For example, an Actor is not required to have an external mailbox, which is required for communication in Erlang [Armstrong, et. al. 1992]. Requiring an external mailbox is problematical for Actors because the mailbox would itself necessarily be another Actor thereby immediately leading to an infinite regress. Also, requiring the use of external mailboxes can slow requests between Actors because it would always be necessary to first deposit a request in an Actor’s external mailbox so that the request could later be retrieved. That a request is almost always sent and received without ever residing in persistent storage, where it can be left and later retrieved, is an important engineering goal for Actors.
Re:“What Alan Kay Got Wrong About Objects” by yesco on Sunday November 17, 2019 @04:20PM (#21560117)
Isn't that exactly what Erlang's gen_server does or am I missing something?
Re:“What Alan Kay Got Wrong About Objects” by regulation_d on Sunday November 17, 2019 @04:55PM (#21560283)
seems like OTP to me