From: "Martin Dowie" <martin.dowie@nospam.baesystems.com>
Subject: Re: User define attributes
Date: Mon, 16 Apr 2001 12:37:40 +0100
Date: 2001-04-16T12:37:40+01:00 [thread overview]
Message-ID: <3adad7ab$1@pull.gecm.com> (raw)
In-Reply-To: 9behk1$ik9$1@taliesin.netcom.net.uk
well, if you mean someting like
type My_Type ...;
for My_Type'Image use ...;
you can't (that's for stream read/write only... I think), but as
attributes are defined as functions anyway (check annex L) you can
force your generic to require an Image function and even do nifty
instantiations like...
generic
type My_Type is private;
with function Image (X : My_Type) return String;
package Test is
procedure Call (X : My_Type);
end Test;
with Test;
package Tester is new test (Integer, Integer'Image);
For composite types you have to "roll your own" Image routine that
would probably just call up the scalar 'Image routines in turn
or other rolled composite IMage routines.
Ayende Rahien <Dont@spam.me> wrote in message
news:9behk1$ik9$1@taliesin.netcom.net.uk...
> Okay, what abuot defining my own?
>
> "Martin Dowie" <martin.dowie@nospam.baesystems.com> wrote in message
> news:3ada9cf5$1@pull.gecm.com...
> > don't think you can. I believe 'Image is available for all scalar types.
> > you could do something like
> >
> > generic
> > type Blah is private;
> > function Image (X : Blah) return String;
> > package <...>;
> >
> >
> > Ayende Rahien <Dont@spam.me> wrote in message
> > news:9b9g7c$cp6$1@taliesin.netcom.net.uk...
> > > How do I add attributes to a type I create?
> > >
> > > And how do I require certain attributes to be exist in a type? (I want
a
> > > generic package to accept only types that has 'Image attribute)
> > >
> > > Thanks in advance,
> > > Ayende Rahien
> > >
> > >
> >
> >
>
>
next prev parent reply other threads:[~2001-04-16 11:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-14 13:33 User define attributes Ayende Rahien
2001-04-16 7:27 ` Martin Dowie
2001-04-16 11:23 ` Ayende Rahien
2001-04-16 11:37 ` Martin Dowie [this message]
2001-04-16 14:35 ` Samuel T. Harris
2001-04-16 15:20 ` Martin Dowie
2001-04-16 15:37 ` Brian Rogoff
2001-04-16 16:19 ` Samuel T. Harris
2001-04-16 17:08 ` Marin David Condic
2001-04-16 22:00 ` Samuel T. Harris
2001-04-17 12:34 ` Georg Bauhaus
2001-04-17 20:35 ` Samuel T. Harris
2001-04-24 21:00 ` Samuel T. Harris
2001-04-16 17:37 ` Martin Dowie
[not found] ` <0tEC6.7646$FY5.638172@www.newsranger.com>
2001-04-16 17:34 ` Martin Dowie
2001-04-18 12:14 ` Marius Amado Alves
2001-04-18 20:50 ` Samuel T. Harris
2001-04-19 1:35 ` Jeffrey Carter
2001-04-19 12:50 ` Samuel T. Harris
2001-04-20 19:08 ` Marius Amado Alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox