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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.50.155.103 with SMTP id vv7mr3155789igb.13.1458761343696; Wed, 23 Mar 2016 12:29:03 -0700 (PDT) X-Received: by 10.182.49.197 with SMTP id w5mr53997obn.16.1458761343648; Wed, 23 Mar 2016 12:29:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!y89no9054832qge.0!news-out.google.com!h70ni699qge.0!nntp.google.com!w104no8399952qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 23 Mar 2016 12:29:03 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.238.64.35; posting-account=WGwmlQoAAADDeUXb_cIKMah4KZlJkq5i NNTP-Posting-Host: 85.238.64.35 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Need some help in Ada From: danifreecs@gmail.com Injection-Date: Wed, 23 Mar 2016 19:29:03 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2221 X-Received-Body-CRC: 1448327388 Xref: news.eternal-september.org comp.lang.ada:29863 Date: 2016-03-23T12:29:03-07:00 List-Id: Hello there! I'm a student, and i've got my 1st home project in Ada. I need to implement= a J_String package with a lot of functions etc, but i have problems at the= start. The specification asks me to "implement J_String type as an opaque = discriminant record type. For the inner representation of the string use th= e Standard String type. The discriminant determines the size of the string,= which is contained in the J_String type." My .ads at the moment: package J_String_Pkg is type J_String(Size: Natural) is private; private type J_String(Size: Natural) is record Components: String(Natural Range 0..Natural'Last); end record; end J_String_Pkg; I don't know if the above is good, but the main reason i'm asking help is t= he following methods: function Create(Str : String) return J_String; --Creates a J_String from a String function Value_Of(S : J_String) return String; --Returns the content of S in String type function Is_Empty(S : J_String) return Boolean;=20 -- Returns true if, and only if, length() is 0. I think i can do the other 20+ methods, but i can't figure out how to make = my J_String type to be able to create empty strings. Thanks for every help!