From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7b5b3c67aa2a73fe X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Easy question about Character manipulation From: Georg Bauhaus In-Reply-To: <1d5n0ksoz75yy.3t2hhxjr35fq$.dlg@40tude.net> References: <1170100860.762334.13830@l53g2000cwa.googlegroups.com> <1d5n0ksoz75yy.3t2hhxjr35fq$.dlg@40tude.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-ID: <1170106218.6329.63.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Date: Mon, 29 Jan 2007 22:30:18 +0100 NNTP-Posting-Date: 29 Jan 2007 22:30:15 CET NNTP-Posting-Host: 6ed7c8c5.newsspool1.arcor-online.net X-Trace: DXC=0I2W4@[2hig016@cHD@m;jic==]BZ:afn4Fo<]lROoRa^YC2XCjHcbi\Q7`:d;05WmN[W On Mon, 2007-01-29 at 21:17 +0100, Dmitry A. Kazakov wrote: > On 29 Jan 2007 12:01:00 -0800, mark wrote: > > > I am quite newbie to ada. I have declared something like that: > > size: Integer := 9; > > emptySpaces : array (0..size) of Character := "0123456789"; > > textLine : array (0..size * 3) of Character; > > (must be (size+1)*3-1. Indexing from 0 is an evil thing, trust me! (:-)) > > > Now I would like to have the possibility to initialize textLine > > variable, but when I write: > > textLine := "9876543210" & emptySpaces & "9876543210"; > > > > I got an error 'expected type of textLine' ,'found type od > > emptySpacs...'. I know it is connected with very deep contstaint > > checks > > Yes, emptySpaces and textLine have different types. Yes, and these two different types are *anonymous* types. This means, you have not given them (the types) a name. The array (...) of both "look" like some array of characters, and they are. But they are not the same array type because there is no type name. (Only the object names "emptySpace" and "textLine".) Unlike Pascal, for example, types in Ada are different when they have different names. The types of emptySpace and textLine have no names at all, being anonymous (unnamed) array types. So they don't have the same name, so to speak. Consider this declare type My_Array is array (1 .. 10) of Character; type Your_Array is array (1 .. 10) of Character; x: My_Array; y: Your_Array; begin x := y; end; This won't compile. Ada doesn't permit assignment for objects (x, y) of different types (My_Array, Your_Array) even when they show the same structure (array (1 .. 10) of Character)--but different names.