14

Coming from Scala (and Akka), I recently began looking at other languages that were designed with distributed computing in mind, namely Erlang (and a tiny bit of Oz and Bloom). Both Erlang and Oz are dynamically typed, and if I remember correctly (will try to find link) people have tried to add types to Erlang and managed to type a good portion of it, but could not successfully coerce the system to make it fit the last bit?

Oz, while a research language, is certainly interesting to me, but that is dynamically typed as well.

Bloom's current implementation is in Ruby, and is consequently dynamically typed.

To my knowledge, Scala (and I suppose Haskell, though I believe that was built initially more as an exploration into pure lazy functional languages as opposed to distributed systems) is the only language that is statically typed and offer language-level abstractions (for lack of a better term) in distributed computing.

I am just wondering if there are inherent advantages of dynamic typing over static typing, specifically in the context of providing language level abstractions for programming distributed systems.

adelbertc
  • 7,270
  • 11
  • 47
  • 70
  • 1
    The current implementation of Akka is currently untyped (uses Any for messages). The advent of macros in Scala 2.10 makes easier to implement a typed version. See this video from nescala 2013: http://nescala.org/#t-14537068 – Ionuț G. Stan Apr 12 '13 at 13:55

3 Answers3

15

Not really. For example, the same group that invented Oz later did some work on Alice ML, a project whose mission statement was to rethink Oz as a typed, functional language. And although it remained a research project, I'd argue that it was enough proof of concept to demonstrate that the same basic functionality can be supported in such a setting.

(Full disclosure: I was a PhD student in that group at the time, and the type system of Alice ML was my thesis.)

Edit: The problem with adding types to Erlang isn't distribution, it simply is an instance of the general problem that adding types to a language after the fact never works out well. On the other hand, there still is Dialyzer for Erlang.

Edit 2: I should mention that there were other interesting research projects for typed distributed languages, e.g. Acute, which had a scope similar to Alice ML, or ML5, which used modal types to enable stronger checking of mobility characteristics. But they have only survived in the form of papers.

Andreas Rossberg
  • 34,518
  • 3
  • 61
  • 72
  • Alice ML certainly looks interesting, though it seems there hasn't been any activity on it since 2007? Do you know if there is any future work to be done on it? It seems Oz (specifically Mozart) is planning a version 2 of the platform, according to GitHub activity at least. – adelbertc Apr 11 '13 at 16:35
  • @adelbertc, Alice is still used in teaching freshmen, but sadly I am not aware of any plans for further development. Re Mozart 2: most of the original consortium is no longer involved, and I'm not sure if there even is a concrete time line. – Andreas Rossberg Apr 11 '13 at 17:18
  • (addressing your 2nd edit as well) ah, these languages all seem interesting, but unfortunately all seem to have fallen to the same fate I've seen other research projects fall to.. perhaps Bloom will be the next contender? – adelbertc Apr 11 '13 at 17:50
  • @adelbertc, true. Unfortunately, very few research projects have the resources necessary to turn a project into a product, let alone maintain it. – Andreas Rossberg Apr 12 '13 at 05:39
  • @AndreasRossberg Alice ML had some unusual support for dynamic typing/loading of modules, IIRC. Was that support added specifically for distributed systems? – Steven Shaw Apr 06 '14 at 22:50
  • 1
    @StevenShaw (sorry, I somehow missed your question at the time): More generally, to support what we called _open_ programming. Some forms of distributed programming are an instance of that. But of course, features like dynamic/lazy linking can be relevant even for non-distributed applications. – Andreas Rossberg Oct 26 '14 at 10:30
10

There are no inherent advantages of dynamic typing over static typing for distributed systems. Both have their own advantages and disadvantages in general.

Erlang (Akka is inspired from Erlang Actor Model) is dynamically typed. Dynamic typing in Erlang was historically chosen for simple reasons; those who implemented Erlang at first mostly came from dynamically typed languages particularly Prolog, and as such, having Erlang dynamic was the most natural option to them. Erlang was built with failure in mind.

Static typing helps in catching many errors during compilation time itself rather than at runtime as in case of dynamic typing. Static Typing was tried in Erlang and it was a failure. But Dynamic typing helps in faster prototyping. Check this link for reference which talks a lot about the difference.

Subjectively, I would rather think about the solution/ algorithm of a problem rather than thinking about the type of each of the variable that I use in the algorithm. It also helps in quick development.

These are few links which might help

BenefitsOfDynamicTyping

static-typing-vs-dynamic-typing

BizarroStaticTypingDebate

Community
  • 1
  • 1
Vinod
  • 2,243
  • 14
  • 18
  • 1
    could you please elaborate about "Erlang was built with failure in mind"? – Andriy Tylychko Apr 11 '13 at 17:27
  • 4
    Erlang is built on the notion that failure in one of the components should not affect the whole system. Programming errors, hardware failures or network failures etc are accounted for: the language includes features like supervision tree,monitoring Erlang processes etc which will allow to recover from failure,distribute to different nodes,handle unexpected errors, and never stop running. While most languages and type systems aim to make a program error-free, Erlang assumes that errors will happen anyway and makes sure to cover these cases.Ref:http://learnyousomeerlang.com/types-or-lack-thereof – Vinod Apr 11 '13 at 20:45
0

Cloud Haskell is maturing quickly, statically-typed, and awesome. The only thing it doesn't feature is Erlang-style hot code swapping - that's the real "killer feature" of dynamically-typed distributed systems (the "last bit" that made Erlang difficult to statically type).

amindfv
  • 8,438
  • 5
  • 36
  • 58
  • When I looked recently, it also did not include supervisors, which are one of the best ideas that Erlang brings to the table. Has that changed recently? Of course, having brought that up, it still does not imply dynamic languages have an advantage here - Akka provides these for Scala (and Java), so clearly there's no inherent limitation. – Thomas Lockney Apr 12 '13 at 16:36
  • 1
    Supervision is provided in cloud haskell, not by the distributed-process library but its super-set, distributed-process-platform. This hasn't been released to hackage yet, but does provide support for gen-servers and supervisors along with a few other useful abstractions borrowed from OTP. The first public release is due this summer - I'll update this thread when it happens. – hyperthunk May 06 '13 at 18:56
  • @hyperthunk: Awesome, good to hear! I was reading the Cloud Haskell paper the other day and was missing Erlang style supervision, looking forward to the summer release. – adelbertc May 11 '13 at 04:38
  • @adelbertc - as you can tell, the release has been badly delayed, however it is still cooking and should be available by the end of Feb. – hyperthunk Jan 09 '14 at 11:50