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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7178c15dc3019a0d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 06 Jun 2008 20:16:33 +0200 From: Georg Bauhaus Reply-To: rm.tsoh+bauhaus@maps.futureapps.de User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to extend packages References: <8d94d993-4807-4356-b1ab-1f2bb3f96b98@56g2000hsm.googlegroups.com> In-Reply-To: <8d94d993-4807-4356-b1ab-1f2bb3f96b98@56g2000hsm.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <48497f01$0$27439$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 06 Jun 2008 20:16:33 CEST NNTP-Posting-Host: 1d8f29f7.newsspool4.arcor-online.net X-Trace: DXC=<:H\g;J26VCE4ZB2flKORA4IUK\BH3YB3iKSWkKVHJDA:ho7QcPOVC\jma;6KbI=JYmiQA@aI4GG X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:595 Date: 2008-06-06T20:16:33+02:00 List-Id: snoopysalive@googlemail.com wrote: > Hi, Ada-folks! > > I'd like to extend the GNAT.Regpat a little bit, so that it contains > additional operations like Split (the same as in Perl or Ruby) or Join > (dito). A Split subprogram is available in the AWK section of the GNAT library. > When speaking of "extending" I mean it in the sense of e.g. Java where > extending a class means that the child class contains all the public > or protected operations and attributes as the super class. You can't extend packages in Java either ;-) Like you have said, you extend a class and so in Ada, you extend a type T by deriving a new type D from T. You can do that in the same package, or in a nested package, or in a child package, or in some other package. Since GNAT.Regpat should not normally be touched (it lives in compiler file space), you would indeed write a child package in this case; but note that a child _package_ is a child in the sence of a hierarchical library of modules, like "util" would be a "child package" of "java" in "java.util" if you did use Ada terms for describing Java packages. > Perhaps you > know now, what I want to achieve. I want to have an extended "child" > package of GNAT.Regpat. In the end it should have an own name like > e.g. "Mine.Regex" and contain all operation etc. of its "super" > package plus the operations I'll additionally implement. Just in case you only need more RE matching capabilities, be sure to look an GNAT.Spitbol.Patterns. SPITBOL patterns have everything that Perl5 REs have, including a working \G. > I've been trying for hours now, so I'm passing this question to you. > How to extend package? You don't. -- Georg