comp.lang.ada
 help / color / mirror / Atom feed
From: James Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: The best thing/greatest feature summary
Date: Wed, 01 Nov 2000 03:27:04 GMT
Date: 2000-11-01T03:27:04+00:00	[thread overview]
Message-ID: <39FF8DE3.EC0055B5@worldnet.att.net> (raw)
In-Reply-To: 39ff792d@rsl2.rslnet.net

What is the cost here? It really depends upon how much of
java.lang.reflect
you really want to emulate.

For instance, most of the classes in java.lang.reflect rely on an
ability
to suppress access checks. They fundamentally violate the access
restrictions
designed into classes and class members.

Do you want to emulate supression of access checks, so that Ada data and 
subprograms defined in the private part of a package specification, or
in
the body of a package, will be have public visibility?

In other words, do you want to be able to destroy encapsulation?

If you only want to emulate the Member interface in java.lang.reflect
you can instantiate the following generic package in the bodies of your 
packages.

-----------------------------------------------------------------------
-- Generic package to define a "common" interface for providing
-- debug information.
-----------------------------------------------------------------------
generic

   Package_Name : String;
   
package Reflect is

   function Get_Package return String;
   function Get_Name return String;
   procedure Set_Name(Id : in String);
   
end Reflect;

-----------------------------------------------------------------------
-- Generic package body to define a "common" interface for providing
-- debug information.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;

package body Reflect is

   Proc_Name : Ada.Strings.Unbounded.Unbounded_String;

   --------------
   -- Get_Name --
   --------------

   function Get_Name return String is
   begin
      return Ada.Strings.Unbounded.To_String(Proc_Name);
   end Get_Name;

   -----------------
   -- Get_Package --
   -----------------

   function Get_Package return String is
   begin
      return Package_Name;
   end Get_Package;

   --------------
   -- Set_Name --
   --------------

   procedure Set_Name (Id : in String) is
   begin
      Proc_Name := Ada.Strings.Unbounded.To_Unbounded_String(Id);
   end Set_Name;

end Reflect;

------------

I see no reason to make this package part of the language standard
simply
because Java defines an interface with similar capabilities. However,
you may find such a package highly necessary. That is why I have posted
it here. Use it if you wish.

Jim Rogers
Colorado Springs, Colorado


Tom Hargraves wrote:
> 
> Good point James.
> All these ease-of-programming features come at a cost.
> 
> But what is the cost here? A few strings can hardly be much of a cost
> nowadays. I'm not asking for a 1Mbyte dynamic .GIF icon to popup, just a
> routine name...
> 
> These 256 byte strings could live quite happily in the corner of the xMbyte
> proms and nobody would even know they where there ;-)
> 
> (OK, so I'm setting myself up here. There's bound to be a space shuttle
> designer out there who knows the weight of a byte of memory and how much it
> costs to put it in orbit...)
> 
> Regards,
> Tom H.



  reply	other threads:[~2000-11-01  3:27 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <39DCB9E3.EAE8F426@ftw.rsc.raytheon.com>
2000-10-27 22:08 ` The best thing/greatest feature summary Wes Groleau
2000-10-28  1:01   ` Lothar Scholz
2000-11-24  2:15     ` Peter Horan
2000-11-24  0:00       ` Lothar Scholz
2000-11-24  0:00         ` Friedrich Dominicus
2000-10-28  1:03   ` Lothar Scholz
2000-10-31 14:44     ` Tom Hargraves
2000-10-31 18:07       ` tmoran
2000-10-31 19:58         ` Larry Kilgallen
2000-11-01  1:56         ` Tom Hargraves
2000-10-31 19:28       ` James Rogers
2000-11-01  2:13         ` Tom Hargraves
2000-11-01  3:27           ` James Rogers [this message]
2000-11-01 12:48             ` Ken Garlington
2000-11-01 14:03               ` Pat Rogers
2000-11-01 15:30               ` James Rogers
2000-11-01 22:12                 ` Tom Hargraves
2000-11-01 22:44                   ` Ted Dennison
2000-11-01 22:54                   ` Pat Rogers
2000-11-01 23:47                     ` James Rogers
2000-11-02  5:25                       ` Pat Rogers
2000-11-02  5:28                       ` Pat Rogers
2000-11-02 22:00                       ` Wes Groleau
2000-11-02  3:45                 ` Reflection (was: Re: The best thing/greatest feature summary) Jeff Carter
2000-11-02  6:57                   ` Ray Blaak
2000-11-02  8:42                     ` tmoran
2000-11-02 11:19                       ` David C. Hoos, Sr.
2000-11-02 18:09                         ` tmoran
2000-11-02 12:51                       ` David C. Hoos, Sr.
2000-11-03  2:26                         ` Jeff Carter
2000-11-02 14:33                     ` Tucker Taft
2000-11-02 16:02                     ` Ted Dennison
2000-11-04  0:00                       ` Florian Weimer
2000-11-03  2:23                     ` Jeff Carter
2000-11-03  5:05                   ` Randy Brukardt
2000-11-03  5:28                     ` Ken Garlington
2000-11-04  4:13                     ` Jeff Carter
2000-11-10  0:00       ` The best thing/greatest feature summary jacob navia
2000-10-31 21:01   ` Wes Groleau
2000-10-30 20:19 ` Roger Browne
2000-10-31 16:24   ` Greg
2000-10-31 16:55   ` Roger Browne
replies disabled

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