HN user

Zalastax

213 karma

MSc thesis "Singly typed actors in Agda": http://studentarbeten.chalmers.se/publication/256251-singly-typed-actors-in-agda-an-approach-to-distributed-programming-with-dependent-types

Posts1
Comments116
View on HN

Interesting! I suppose one could prepare for that by having a second profile with just a few questions solved?

Go 1.18 4 years ago

You may find my MsC thesis, link in profile, interesting! If I remember my writing correctly, I have similar reflections on CSP.

My view on 2 is that you get into a quite different mindset when you program actors, compared to objects. For starters, since each actor is scheduled separately, it becomes routine to not assume too much about the internal state of the actor. So you won't see many getters + setters in Erlang, for example. You also need to structure your program to not communicate unnecessarily, since communication may fail and requires you to wait for the other actor to reply. This makes you to think about what state should belong to which actor. It is quite subtle and is best seen by experiencing it, but I think the programs turn out quite different, and in my view better. Actors are not perfect for everything but to me they are what object oriented programming should have been.

Totally agree. I think that locality is what separates true functional programming from languages where some of functional programming features have been added on top. Immutability and types that track effects are means of achieving locality.

I touched on this in my MSc thesis [1], see section 2.6 and 3.4.1. The original CSP can only work if you stay on a single machine. You can have channels in a distributed setting but you need to make the reading capability of a channel limited to a single consumer. If there are multiple possible readers at the same time it gets impossible to know where to send each message and in a distributed setting there's no way of solving that, short of solving distributed consensus. Cloud Haskell [2] section 4 touches this as well.

[1] http://studentarbeten.chalmers.se/publication/256251-singly-... [2]: https://www.microsoft.com/en-us/research/wp-content/uploads/...

Your point still stands but, since the field has so many terminologies that are conflated, I wanted to let you know that "active objects" is a specific kind of actor model and Erlang is not an instance of that model. Active Objects is essentially Java but with asynchronous calls, much like using gen_server for everything.

A good paper that untangles the terminology is "43 years of actors: a taxonomy of actor models and their key properties".

Sure,and lots of codebases are completely untyped. I find it great that you can opt out of the theorem proving that type checking is when crunch time comes. As such it functions as a loan and your organization should strive to pay back the debt when it can. Nothing can save you if you never get a calmer period.

I instead proclaim that it brings you the best of both worlds. Finding the right mix of static/dymamic is a balance act but if you do so you get the benefits of static types (safety, documentation, tooling) and dynamic types (fast prototyping, not having to write convuluted code to please the compiler). What are the killer features that gradual types lose out on?

Can you expand on what you mean? What is "the matrix model of computation" and "vectors of unity"?

Which actor model are you talking about? The variants are very different and Hewitt's original paper is mainly referenced for coming up with the name rather and kicking off the field than inventing a usable model.

Type theory is even vaster. Are we talking homotopy type theory? Calculus of constructions? System F?

As far as I know Pony doesn't yet have a distribution story so supervision might not be priority for the maintainers yet. However, since Pony is an "Active Objects"-language, every actor in Pony is essentially an instance of a genserver - this is what makes it easy to type. Supporting more advanced communication patterns in a strongly typed fashion is rather difficult so for the foreseeable future I believe that a gradual typing approach will be the way to go. Genserver is also very powerful so Pony can likely see good success if they just build in some supervision strategies and make it possible to distribute.

The Little Typer 8 years ago

You could just assert that i%2 == 0 via some postulate - as long as the proof is irrelevant for the code that is. Doing so is similar to converting from any in a gradual type system: if the assertion is correct you get correct code with little work and if you're uncorrect you're no worse off than if you had no types at all.

There are difficulties with dependent types, but having to go all in can be avoided via a shift in culture.

Thanks, I did not know that!

TypeScript can do type refinements based on the flow (e.g. a null check refines a type with null to one without) but can't do what you just showed. Are there any tools that can emit the inferred types to source code? I just now got a vision of using flow style type inference to gradually augment a project with either flow or TS types with very little work.