OBJECTS, TIME AND CONSTRAINTS IN OPENMUSIC Carlos Agon, G~rard Assayag, Olivier Delerue, Camilo Rueda. { agonc,assaiyag,delerue,crueda}) @ ircam.fr IRCAM - 1 P1. Stravinsky. F-75004 Paris, France. 1. Abstract OpenMusic is a object oriented visual programming environment for music composers. It is based on Macintosh CommonLisp and Common Lisp Object System. It shows several original features, such as reflexivity, metaprogrammation capacities, handling of the duality between musical time and computational time, and provides with a framework of predefined musical objects for handling sound, midi and musical notation. Common Music Notation in OpenMusic is an extension of CMN, a public domain notation package by Bill Schottstaedt [5CO98]. 2. Objects 2.1. Underlying Object Model. Broadly speaking, basic calculus for object-oriented programming inherited the approach imposed by the precursory language Simula and its followers. The tentatives to formalize this family of object models used the concepts of parametric polymorphism or true polymorphism [CaWe85]. More recently, languages based on multiple-dispatching (methods that dispatch on a product of types rather than a single type) such as CLOS [Steel9O] were also formalized [Cast98], using concepts of overloading or ad-hoc polymorphism. As OpenMusic, based on CLOS, may very well be formally described in this way, we will give here a brief summary of the X&calculus used by [Cast98]. We restrain to the extension of X-calculus by the concept of generic functions which is at the base of X&-calculus. A generic function is simply a collection of simple functions (X-abstractions), which we will call methods. We must also distinguish the simple application indicated by ~.~ from the application of generic functions indicated by the operator. Thus a generic function with n methods can be specified by the expression: (t & M1 & M~2 &.. & Ma). The type of a generic function made up with methods Mi of the type U1- lj, is defined by: {U1 -* 14,U2 -* 72~,..., U, - Vj 1~. In X&-calculus, however not any set of method types can be seen as the type for a generic function. A set of methods types {U1 -* V}i, is a generic function type iff for all i3j e I the two following conditions are satisfied: 1~ J J U is maximum in LB(U,,UJ) ~ 3!h eI, Uh = U where LB(U, V) indicates the set of common lower boundaries of types U and V. This enforces consistency in the case of multiple inheritance. The application of a generic function G to an argument N of type U consists in the selection of a method M1 among the methods of G, then the application ofj to N. (E&M&M,...M,)N t M1..N Note that U may not be contained in the set U1 of input types to the generic function. In such case we select the method A/I satisfying: U, =min,=1__, {U. U < U1 }. The ~ ordering is defined by the class precedence list CPL. The CPL for class C is a topological order of the superclasses of C. An object in the X&-calculus is a simple register 4I =,..,1 =.~ )A register can be seen as a set of labelled fields l=T where 1 is called label andT is called value. There is a reduction rule for the field selection: ljl = T~,.,I n~l: We add also the context rules for general expressions in X&-calculus: ~ D F' = (E.l D E.1) A\ (.1= F...) D.. = E...)). If objects are seen as registers, classes will then be seen as generators of registers. We assume that there is a generic function ~cnew~ and that each class defines a method for this generic function. We also assume in what follows that the type of an object is its class. This is the rule for subtyping in the case of generic functions: Vi E I,3j e J,S1 -*; IU ~T Thus, the inheritance mechanism for the X&-calculus is defined by the subtyping and the mechanism of method selection. If we call a generic function of type {C1 -* 77}i~ with an instance of the class C, then the method 0
Top of page Top of page