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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6b1bfc6ba4e8ada X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!novso.com!news.skynet.be!195.238.0.222.MISMATCH!newsspl501.isp.belgacom.be!tjb!not-for-mail Date: Wed, 13 May 2009 17:20:06 +0200 From: Olivier Scalbert User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: newbie problem References: <4a0ad646$0$2854$ba620e4c@news.skynet.be> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4a0ae524$0$2849$ba620e4c@news.skynet.be> Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: 772d35a1.news.skynet.be X-Trace: 1242228004 news.skynet.be 2849 87.65.200.8:49238 X-Complaints-To: usenet-abuse@skynet.be Xref: g2news2.google.com comp.lang.ada:5817 Date: 2009-05-13T17:20:06+02:00 List-Id: Martin wrote: >> Problem 1: it does not compile ! >> adasound.ads:23:10: completion of nonlimited type cannot be limited >> adasound.ads:23:10: component "File_Type" of type "Als_File_T" has >> limited type > > Store an 'access' to the limited type. > >> Problem 2: how to avoid the first "with Sequential_Io;" ? > > private with Ada.Sequential_IO; -- I always prefer the > -- Ada. prefix just to be clear > -- it's a standard unit to any > -- 'casual' reader > > Cheers > -- Martin Thanks Martin, I have modified the specification and it compiles now: private with Ada.Sequential_Io; package adasound is type Amplitude_T is new Float; type Frequency_T is new Float; type Time_T is new Float; type Stereo_Amplitude_T is record Left : Amplitude_T; Right: Amplitude_T; end record; type Als_File_T is private; function Als_Create(File_Name: String) return Als_File_T; procedure Als_Write(Als_File: Als_File_T; Stereo_Amplitude: Stereo_Amplitude_T); procedure Als_Close(Als_File: Als_File_T); private package Stereo_Amplitude_Io is new Ada.Sequential_Io (Stereo_Amplitude_T); type Als_File_T is record File_Type: access Stereo_Amplitude_Io.File_Type; -- perhaps more stuff later end record; end adasound; How can implement the Als_Create function ? Here is my code, but it does not compile ! package body adasound is function Als_Create(File_Name: String) return Als_File_T is Result : Als_File_T; File: Stereo_Amplitude_Io.File_Type; -- Error !!! begin Stereo_Amplitude_Io.Create(File, Stereo_Amplitude_Io.Out_File, File_Name); Result.File_Type := File; -- Line 10 Error !!! return Result; end Als_Create; ... gcc-4.3 -c adasound.adb adasound.adb:10:22: left hand of assignment must not be limited type Olivier.