login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for AxiomProgrammingDiscussion revision 2 of 4

1 2 3 4
Editor: Bill Page
Time: 2008/07/24 22:18:00 GMT-7
Note:

changed:
-MetaClass versus Category
-
-Axiom has a two-level type system consisting of categories and domains.
-
-In Axom domains are
Meta-classes versus Categories

  Axiom has a two-level type system consisting of categories and domains.

Axoim domains are like

changed:
-
-The instances of domains are called objects. For example -1 is an object
-of the domain Integer.
-
-Each domain belongs to one or more categories. Categories specify the
-external interface, i.e. what methods a domain exports plus optional
-default implementations of some of these methods. For example the
-domain Integer belongs to the category IntegerNumberSystem.
however there are some differences. The instances of classes are
called objects. Objects inherit all the methods defined in a class.
Instances of domains on the other hand are just "values". For
example "-1" as an object in a class named "Integer" provides basic
arithmetic operations like "+" and "*" with which it can interact.
In effect we "ask" -1 to add itself to some other number. As a value
of the domain Integer, -1 is just a value. It carries no type
information in itself except that it is a member of this domain.
In most cases operations involving the creation of values of a given
domain are provided by the domain to which the value belongs, but
operations involving its members will often be selected from domains
other than Integer.

This distinction between classes and domains is also related to
"static versus dynamic typing":http://en.wikipedia.org/wiki/Type_system

Each domain must satisfy one or more categories. Categories specify
the external interface, i.e. what methods a domain exports plus
optional default implementations of some of these methods. For example
the domain Integer "has" the category IntegerNumberSystem. In
addition to specifying an interface, categories serve as "predicates"
which group domains according to the intended properties that all
such domains are intended to share. This is how mathematical
concepts are represented in Axiom.

changed:
-So an Axiom category is actually a
-"meta-class":http://en.wikipedia.org/wiki/Metaclass
An Axiom category is similar to a
"meta-class":http://en.wikipedia.org/wiki/Metaclass in object-oriented
programming. A meta-class is a class whose objects are classes in their
own right. In Axiom however domains are not instances of categories.
Categories do not provide operations which create domains, rather in
it's definition a domain is statically declared to satisfy a given set
of categories.

Meta-classes versus Categories

Axiom has a two-level type system consisting of categories and domains.

Axoim domains are like classes in the sense of object-oriented programming however there are some differences. The instances of classes are called objects. Objects inherit all the methods defined in a class. Instances of domains on the other hand are just "values". For example "-1" as an object in a class named "Integer" provides basic arithmetic operations like "+" and "*" with which it can interact. In effect we "ask" -1 to add itself to some other number. As a value of the domain Integer, -1 is just a value. It carries no type information in itself except that it is a member of this domain. In most cases operations involving the creation of values of a given domain are provided by the domain to which the value belongs, but operations involving its members will often be selected from domains other than Integer.

This distinction between classes and domains is also related to static versus dynamic typing

Each domain must satisfy one or more categories. Categories specify the external interface, i.e. what methods a domain exports plus optional default implementations of some of these methods. For example the domain Integer "has" the category IntegerNumberSystem?. In addition to specifying an interface, categories serve as "predicates" which group domains according to the intended properties that all such domains are intended to share. This is how mathematical concepts are represented in Axiom.

All types (domains and categories) in Axiom are "first-order", i.e. they have some representation at run-time. They can be stored as values of variables and they can be passed and returned as values of functions. In other words Axiom domains are themselves objects.

An Axiom category is similar to a meta-class in object-oriented programming. A meta-class is a class whose objects are classes in their own right. In Axiom however domains are not instances of categories. Categories do not provide operations which create domains, rather in it's definition a domain is statically declared to satisfy a given set of categories.