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: 103376,6bee08c26af9486d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Learning Ada but missing the basics? References: <85e95c57-07c3-42eb-b9b9-eac5fd3d0d65@i76g2000hsf.googlegroups.com> In-Reply-To: <85e95c57-07c3-42eb-b9b9-eac5fd3d0d65@i76g2000hsf.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1214862487 12.201.97.213 (Mon, 30 Jun 2008 21:48:07 GMT) NNTP-Posting-Date: Mon, 30 Jun 2008 21:48:07 GMT Organization: AT&T ASP.att.net Date: Mon, 30 Jun 2008 21:48:07 GMT Xref: g2news1.google.com comp.lang.ada:968 Date: 2008-06-30T21:48:07+00:00 List-Id: ryan k wrote: > I'm trying to learn Ada because a) I think it's cool to learn new > computer languages and b) it looks like a good one. I've gone the > through a lot of the tutorials but lets say have package MyPackage and > 5 subprograms are in the body. Which procedure is run first? Is it > sequential? Is there some sort of equivalent to C's main()? Is a > binary created for every package? I guess I don't understand where > things start and end. Any help or links are greatly appreciated! You've clearly missed something. Ada is a concurrent language; this answer assumes you haven't created any tasks. The thread of control in an Ada program is called the environment task. It performs elaboration and initialization as needed, calls the main-program procedure, and finally performs any finalization that's needed. The main-program procedure is one that you designate during the building of the executable. Subprograms in packages are only "run" if they're called. Consider the typical hello-world example: with Ada.Text_IO; procedure Hello is -- null; begin -- Hello Ada.Text_IO.Put_Line (Item => "Hello, World!"); end Hello; Here, procedure Hello is the main-program procedure. You indicate that when building the executable. For instance, with GNAT you would put it in a file named hello.adb and might say gnatmake -gnato -fstack-check -O1 hello which will create an executable named hello[.platform-dependent-extension]. Ada.Text_IO is a package which contains a number of subprograms. In this example, we call its procedure Put_Line. Put_Line may call other subprograms in Ada.Text_IO or in other packages. These are the only subprograms that are "run". HTH. -- Jeff Carter "Your mother was a hamster and your father smelt of elderberries." Monty Python & the Holy Grail 06