I'm wondering which of the dynamic object-oriented (or prototype-oriented) languages (like JavaScript, Ruby, Python, etc.) can be considered as the closest to Abadi and Cardelli's untyped sigma calculus?

  • 3
    $\begingroup$ Javascript. It's the only one not based on classes. $\endgroup$ – Dave Clarke May 6 '16 at 7:09
  • $\begingroup$ And what if we add classes as factories that generate class instances? In the way how classes are introduced into Abadi and Cardelli's untyped calculus (in Section 6.6, "Traits, Classes, and Inheritance"). As I understand, classes in Ruby are the same: they generate instances, but since there is no static typing we can later update of add new methods for these instances. $\endgroup$ – ps_ttf May 6 '16 at 8:47
  • 3
    $\begingroup$ Re first sentence, this idea is applicable to Javascript and the sigma calculus. In Ruby, you can only create objects from classes. You cannot just write down an object, as you can in Javascript and the sigma calculus. $\endgroup$ – Dave Clarke May 6 '16 at 15:09
  • $\begingroup$ And is it possible to update methods in JS as in sigma? $\endgroup$ – ps_ttf May 6 '16 at 17:59
  • $\begingroup$ That is surely something you can google. $\endgroup$ – Dave Clarke May 6 '16 at 19:17

JavaScript looks perfectly like untyped sigma calculus.

It supports first-class citizens, described in paper concepts in terms of prototypes, closures, clone (called split), (dynamic) method override, objects dynamic creation, extension, delegation, subsumption, object fragments and polymorphism (which is understatement in terms of this language). Essentially it supports every operation described in the paper.

Since it uses prototype based inheritance the update of methods is one of the basic operations in this model. It recently started to support hierarchical class inheritance (but it was not needed, since emulating any kind of hierarchical behavior is possible with very short code).

Origins of Cardelli work predates the creation of JavaScript, but also worth mentioning is that JavaScript description as general purpose any language emulator with very short code to support such was described by Don Knuth (which predates Cardelli work, no connection between Knuth paper and creation of JS was ever made in any direction, but both papers exactly describe the JS properties).

Other languages fail with method backups or dynamic method override. But this is not the case for other prototype based languages (at least the most populqr ones), which fully support $\varsigma\text{-calculus}$ (take for example "Self").

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.