Dynamic typing and programming distributed systems
Asked Answered
C

3

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.

Committeewoman answered 11/4, 2013 at 15:53 Comment(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: nescala.org/#t-14537068Fibrovascular
C
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.

Catchpenny answered 11/4, 2013 at 16:9 Comment(6)
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.Committeewoman
@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.Catchpenny
(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?Committeewoman
@adelbertc, true. Unfortunately, very few research projects have the resources necessary to turn a project into a product, let alone maintain it.Catchpenny
@AndreasRossberg Alice ML had some unusual support for dynamic typing/loading of modules, IIRC. Was that support added specifically for distributed systems?Whoosh
@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.Catchpenny
K
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

Kopeck answered 11/4, 2013 at 16:49 Comment(2)
could you please elaborate about "Erlang was built with failure in mind"?Vassaux
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:learnyousomeerlang.com/types-or-lack-thereofKopeck
R
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).

Reichert answered 12/4, 2013 at 1:47 Comment(4)
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.Silverman
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.Methacrylate
@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.Committeewoman
@Committeewoman - as you can tell, the release has been badly delayed, however it is still cooking and should be available by the end of Feb.Methacrylate

© 2022 - 2024 — McMap. All rights reserved.