Green (programming language)

From Wikipedia, the free encyclopedia

Green is a statically-typed object-oriented programming language which supports garbage collection, assertions, methods with variable number of parameters, parameterized classes, metaobjects, introspective reflection, and classes as first-class objects. The exception handling is completely object-oriented: it encapsulates exceptions and exception handling in classes, bringing all the power of object-oriented programming to the exception system. A type in Green is a collection of method signatures ― a class B is subtype of a class A if B has at least the method signatures of A, regardless B inherits from A or not. Every subclass is a subtype but not every subtype is a subclass.

Classes are objects, though classless. But they do have types and can be subtypes of normal classes. Then classes are first-class objects without the use of metaclasses. Whenever necessary, basic values such as 1, 6, ‘A’ or 3.14 are considered objects through automatic conversion to wrapper classes Integer, Char, Real, etc. This feature has been adopted recently by Java. In Green, the Any class, corresponding to Object in Java or Smalltalk, can receive any type, even 1, 6 or ‘A’.

The metaobjects of Green are surprisingly efficient and easy to use, a side-effect of being designed together with the language.

[edit] External links

home page of the Green language.