The Design of Class Mechanism for MOBY - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

The Design of Class Mechanism for MOBY

Description:

The Design of Class Mechanism for MOBY. 2 ... design of the class mechanism. with a richer module system. C and JAVA has the rich class mechanisms but week ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 21
Provided by: Pras189
Category:
Tags: moby | class | design | mechanism

less

Transcript and Presenter's Notes

Title: The Design of Class Mechanism for MOBY


1
The Design of Class Mechanism for MOBY
2
  • Earlier Software designers have to choose
    between the following schemes for the development
  • Class rich languages like C or JAVA.
  • Module rich languages like Standard ML.

3
  • Paper describes the design of the class mechanism
  • with a richer module system
  • C and JAVA has the rich class mechanisms but
    week module system
  • Standard ML has rich Module System but lack
  • Class Mechanism
  • Moby provides both rich Class and Module
    Mechanism

4
  • Class in the class mechanism has two roles
  • Implementing Objects
  • Supporting inheritance
  • Based on the above roles class have two type of
    Clients
  • Object Client
  • Class Client

5
  • MOBY It is a ML-like language that
  • supports Class bases mechanisms.
  • MOBY has three mechanism to cover the
  • features of class based languages.
  • Objects and Object Types.
  • Classes and Class Interfaces.
  • Modules and Module Signature.

6
Objects
  • Object in MOBY are collection of fields
  • and methods.
  • Member of Objects fields Methods
  • Operations on Objects
  • Select a field
  • Update a field
  • Invoke a method

7
Object Type
  • Object Type specifies which object members
  • client may use.
  • Object Types are nothing but are interfaces
  • of JAVA.

8
  • Objtype Point
  • meth getX Uint-gtInt
  • meth moveInt -gtPoint
  • Objtype CPoint extends Point with
  • meth getC Uint-gtColor
  • meth shadeColor -gtCPoint

9
Typing
  • Typing in the MOBY is structural rather than
  • Name Subtyping as in JAVA.
  • Structural Subtyping has several variants
  • Width Subtyping
  • Depth Subtyping
  • Full Subtyping

10
Modules
  • Modules in Moby are like ML-Style languages.
  • Signature Controls the Visibility of the
    definitions outside the Modules.
  • Modules may be nested .
  • Partial type revelation can be defined in
    signatures.
  • type type-name lt type

11
  • Module PointTypes
  • objtype Point
  • meth getX Uint-gtInt
  • meth move Int -gtPoint
  • Type CPoint lt Point
  • body of the PointTypes

12
MOBY Class
  • Defines the implementation of object
  • It contains the declaration of
  • fields
  • Method
  • Makers (which are constructors in C or JAVA)

13
(No Transcript)
14
Class interface
  • It is a signature of the class
  • It is not interfaces as in JAVA.
  • It defines both object and class view.

15
(No Transcript)
16
Visibility
  • Internal Class View
  • External Class View
  • Internal Object View
  • External Object View

17
(No Transcript)
18
(No Transcript)
19
Class based features are realized inMOBY
  • Static Class Members
  • MOBY relies on Module system to support global
    definition.
  • C private inheritance
  • In MOBY Object Type implemented by subclass
  • is independent of the Object Type implemented by
  • its super class.

20
  • JAVAs interfaces and Cs multiple inheritance
    with abstract base classes
  • MOBY has the Structural sub typing relationship.
  • Final Classes
  • We can have this by hiding the class in a module
    and
  • controlling the visibility of its methods .
  • C friends and JAVAs package scope
  • MOBY uses the combination of modules and
  • partial type revelation
Write a Comment
User Comments (0)
About PowerShow.com