Path: utzoo!mnetor!uunet!ncc!alberta!att-ih!pacbell!ames!pasteur!cory.Berkeley.EDU!seitz From: seitz@cory.Berkeley.EDU (Matthew Eric Seitz) Newsgroups: comp.lang.modula2 Subject: Re: Structured Types Message-ID: <2453@pasteur.Berkeley.Edu> Date: 17 Apr 88 03:19:21 GMT References: <5572@uwmcsd1.UUCP> Sender: news@pasteur.Berkeley.Edu Reply-To: seitz@cory.Berkeley.EDU.UUCP (Matthew Eric Seitz) Organization: University of California, Berkeley Lines: 31 In article <5572@uwmcsd1.UUCP> markh@csd4.milw.wisc.edu (Mark William Hopkins) writes: > " Consider the following two segments: " " A := 3; A[1] := 3; " B := A; B := A; " WriteCard(B) WriteCard(B[1]) " "They both do the same thing. In the first, we can see that 3 will be "written out by performing the successive transformations (beta reductions): " "A := 3; B := A; WriteCard(B) --> B := 3; WriteCard(B) --> WriteCard(3) " "However, were we to try this with the latter segment, we would be blocked. "There is nothing that explicitly says that B[1] is assigned the value of "A[1]. "[...] " There are two ways to go with this. Either one could eliminate "assignments to structured types -- essentially B := A is just a syntatic "sugaring of the corresponding for loop -- or one could include structured "EXPRESSIONS and CONSTANTS. "[...] I don't see why you are blocked. Modula-2 does implement your first suggestion: it is a sugaring of the corresponding for loop. See _Programming_ In_Modula-2_ (3rd ed.) pp. 37, 1O5. This does explicitly say that B[1] is assigned the value of A[1]. Also, this does not eliminate assignments to structured types. Matthew Seitz seitz@cory.berkeley.edu