Newsgroups: comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!hookup!swrinde!sdd.hp.com!news.cs.indiana.edu!jsobel@cs.indiana.edu
From: "Jonathan Sobel" <jsobel@cs.indiana.edu>
Subject: Re: Type Specifyer Question
Message-ID: <1995Jan30.145229.16337@news.cs.indiana.edu>
Organization: Computer Science, Indiana University
References: <D36Ht1.ECI@undergrad.math.uwaterloo.ca>
Date: Mon, 30 Jan 1995 14:52:25 -0500
Lines: 21


If you want to limit the sorts of things a collection can hold or its
size, you can use the "limited" function to construct a new type which
meets your needs.

In your example, you wanted a 4x4 array of floats:

	define class <transform-matrix> (<object>)
	  ...
	  slot matrix :: limited(<array>, of: <float>, size: #(4, 4));
	end class;

(Sorry if I didn't get your example quite right; I don't have your
article in front of me.)

Making this sort of clarification to the type should have the double
benefit of catching more errors and giving the compiler more
information to use for optimization.

					Jonathan Sobel
					jsobel@cs.indiana.edu
