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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f6b9e7a488a8fbdb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Marius Amado Alves Newsgroups: comp.lang.ada Subject: Re: a beginner question Date: Thu, 21 Oct 2004 12:47:39 +0100 Organization: Cuivre, Argent, Or Message-ID: References: <10b97a973c8cc17010b8a5e9d55be273@localhost.talkaboutprogramming.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1098359282 31549 212.85.156.195 (21 Oct 2004 11:48:02 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Thu, 21 Oct 2004 11:48:02 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en In-Reply-To: <10b97a973c8cc17010b8a5e9d55be273@localhost.talkaboutprogramming.com> X-OriginalArrivalTime: 21 Oct 2004 11:47:24.0775 (UTC) FILETIME=[BB732F70:01C4B763] X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:5574 Date: 2004-10-21T12:47:39+01:00 Discriminated types don't let you do indiscriminated things on them :-) Proficiency with discriminated types is a big part of being an Ada expert. Read the chapter on discriminated types of an Ada textbook. Ben-Ari's or Barnes'es. In the meanwhile and for the things you seem to be trying to do you can safely use a normal type and constructor functions. mr1yh1 wrote: > i am very new in ada , i try to write codes from book and see result > i tried something but i couldnt get a good result > (i use gnat) > > ****************** > with Ada.Text_Io;use Ada.Text_Io; > procedure test is > type Sex_T is > (Male, > Female); > > type Person ( S:Sex_T:=Male )is > record > Age:Positive ; > Sex:Sex_T:=S;------please look at here first > case S is > when Male => > Has_Wife:Boolean ; > when Female=> > Has_Husband:Boolean; > end case; > end record;--person end > Me : Person; > she : Person (Female); ---- and this one , > begin > Me:=( > S => Male, > Sex => Male, > Age => 33, > Has_Wife => True); > she:=( > S => Female, > Sex => Male, ---please look at here now!!!!! > > Age => 23, > Has_Husband => True); > Put(Sex_T'Image(she.Sex)); > end test; > > **** > there is not any alert > and result is > " male " ?? > > if i dont put "sex=>male" , or "sex=>female" > it dont let me to use a named association... > > even is i dont put " s=> female " > it dont let me too , > but i said about discriminant > when i declare the variable ( she : person(female) ) > > why its not possible ? > to put > she:=(age=>23,has_husband=>true); > > > regards > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada-france.org > http://www.ada-france.org/mailman/listinfo/comp.lang.ada >