comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@maps.futureapps.de>
Subject: Re: How to extend packages
Date: Fri, 06 Jun 2008 20:16:33 +0200
Date: 2008-06-06T20:16:33+02:00	[thread overview]
Message-ID: <48497f01$0$27439$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <8d94d993-4807-4356-b1ab-1f2bb3f96b98@56g2000hsm.googlegroups.com>

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



      parent reply	other threads:[~2008-06-06 18:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 17:00 How to extend packages snoopysalive
2008-06-06 17:24 ` witmer
2008-06-06 17:45 ` Sébastien Morand
2008-06-07 14:21   ` Stephen Leake
2008-06-07 16:04   ` Simon Wright
2008-06-07 21:50     ` snoopysalive
2008-06-08 11:09       ` Simon Wright
2008-06-09 22:38         ` snoopysalive
2008-06-10  5:40           ` Simon Wright
2008-06-14  8:45             ` snoopysalive
2008-06-06 18:16 ` Georg Bauhaus [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox