comp.lang.ada
 help / color / mirror / Atom feed
From: "Alejandro R. Mosteo" <alejandro@mosteo.com>
Subject: Generic formal type with 'Image
Date: Wed, 6 Jun 2018 15:03:22 +0200
Date: 2018-06-06T15:03:22+02:00	[thread overview]
Message-ID: <pf8m2r$vj$1@dont-email.me> (raw)

I'm pretty sure the answer is "no", but just in case:

Is there a formal for a generic that serves for any type that has a 
predefined 'Image?

The purpose is to avoid:

generic
    type Printable is ... -- What should go here?
    with function Image (P : Printable) return String is <>;
package

and then have to pass the 'Image attribute as the Image function in all 
instantiations.

The closest thing I can think of is (<>) but that won't do for floating 
point types.

I understand this is an unusually narrow case (I need a generic for many 
numeric types, both discrete and floating, and this would save me some 
typing -- that I have already spent here anyway.)

With these issues I feel a kind of overlap/missed connection between 
attributes and interfaces.

Thanks,
Alex.


             reply	other threads:[~2018-06-06 13:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 13:03 Alejandro R. Mosteo [this message]
2018-06-06 14:18 ` Generic formal type with 'Image ytomino
2018-06-06 15:34 ` Jeffrey R. Carter
2018-06-06 18:35 ` Alejandro R. Mosteo
2018-06-07  8:35   ` Marius Amado-Alves
2018-06-07 21:26     ` Randy Brukardt
2018-06-06 18:56 ` Shark8
2018-06-06 20:34   ` Randy Brukardt
replies disabled

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