|
Project Information
Members
Featured
Downloads
Wiki pages
|
NewsUploaded MSc Thesis about ECT: Hot class swapping in Erlang2011-10-09 ECT v0.3 packed2010-01-17 ECT v0.3 is available for download here: ect-0.3.tgz. See README.TXT for installation, and browse the classes in tests/feature_tests to see usage examples. New features include:
ECT v0.3 released2009-12-06 SVN checkout is possible in the Source tab, or it can be directly browsed here. Currently comments are beeing added to the source code. Erlang workshopECT was presented at the Erlang Workshop of ICFP 2009. Click here to download the slides. Thank you for the lot of useful comments! ECT wikiThe documentation on this web site is still being developed! Last updated: 2009-08-25 Note that all documentation corresponds to ECT v0.2. ECTThe question of adding or not adding Object-Oriented Programming (OOP) to Erlang often attracts debate. We know that everything that can be done in OOP can be done in Erlang with its extensive support for polymorphism and late binding of function calls. OOP can be seen as a fixed pattern to use these things. As using patterns in software tend to be a good thing, ECT introduces the pattern of classes to Erlang. We do not want to turn Erlang into a new Java or to force "everything to be a class". Patterns always have to be used with care. ECT just introduces the possibility of using classes and objects, the programmer decides where to do this. There already exist some OOP extensions for Erlang. The aim of ECT is to add OOP to Erlang as discretely as possible, so that classes fit well with existing Erlang concepts. For this reason, they are actually extended Erlang records. Their additional behavior comes into picture only when the programmer needs it. Because of this:
ExampleThe killer feature of ECT is intended to be that classes are like extendable records. Assume that we have three classes:
Joe = #giraffe{weight = 1500, color = green, height = 5.1},
Bill = #bird{weight = 8, color = red, wingspan = 3.5, glide_ratio = 23}Okay, we created two objects like records. After this, comes the trick: X = Joe#animal.weight,
#animal{color = red, weight = Z} = Bill,
Johnny = Joe#animal{color = yellow}This can not be done with pure records: if we do not care about the specific features of specific animals, we can handle them in a common way by the use of their common superclass. These patterns and expressions can be used every place* where they can be used with records. Methods can also be defined for these objects. *They can really be used any place in your code, but when object-matching patterns are used in clause heads, then the set of patterns that can be embedded into them is a bit limited. Download and installationDownload: ect-0.2.tgz Howtos: Installation README.TXT UsageAfter the Installation of ECT, you may try defining and compiling a class. Then you can also define an inherited class, or write some methods. If you want to use ECT classes without the ECT engine, knowing the internal data structure of classes might also be useful. Objects can also automaticaly put into processes, but this is in an even more beta stage than the rest of ECT. Contact
|