Previous section: Module declarations

Dylan reference manual -- Examples

Examples

define module graphics

use dylan;

create draw-line,

erase-line,

invert-line,

skew-line

frame-rect,

fill-rect,

erase-rect,

invert-rect;

end module graphics;

define module lines

use dylan;

use graphics,

import: {draw-line,

erase-line,

invert-line,

skew-line};

end module lines;

define module rectangles

use dylan;

use graphics,

prefix: "graphics$",

exclude: {skew-line};

end module rectangles;

define module dylan-gx

use dylan, export: all;

use graphics,

rename: {skew-line => warp-line},

export: all;

end module dylan-gx;

The modules created by these module declarations would have access to variables with the following names:

graphics draw-line

erase-line

invert-line

skew-line

frame-rect

fill-rect

erase-rect

invert-rect

plus all the variables in the Dylan module

lines draw-line

erase-line

invert-line

skew-line

plus all the variables in the Dylan module

rectangles graphics$draw-line

graphics$erase-line

graphics$invert-line

graphics$frame-rect

graphics$fill-rect

graphics$erase-rect

graphics$invert-rect

plus all the variables in the Dylan module

dylan-gx draw-line

erase-line

invert-line

warp-line

frame-rect

fill-rect

erase-rect

invert-rect

plus all the variables in the Dylan module

The lines and rectangles modules do not export any variables. They are presumably used to provide definitions for the variables created and exported by the graphics modules. The difference between the graphics module and the dylan-gx module is that one variable is renamed, and the dylan-gx module exports the variables which it imports from the dylan module, while the graphics module does not.

Next section: 15. Libraries