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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,84bf0ec36cf20893 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-17 10:04:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Would an *AdaScript* language be a good / bad idea? Date: 17 May 2002 12:58:06 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <5ee5b646.0205140618.2d789fc9@posting.google.com> <5ee5b646.0205151846.4b14a73f@posting.google.com> <3CE3D8B4.C272C737@san.rr.com> <3CE3EA03.394B3EA@despammed.com> <3CE3FFE7.775E5103@san.rr.com> <3CE514CD.DC9C679@despammed.com> <3CE52E77.FC3FC588@san.rr.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1021655109 23063 128.183.220.71 (17 May 2002 17:05:09 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 17 May 2002 17:05:09 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:24295 Date: 2002-05-17T17:05:09+00:00 List-Id: Darren New writes: > Write a piece of Ada code that declares a new type at run-time > based on a user's input, perhaps a derived type of a tagged type, and loads > it into the currently running program, instantiates it, and sticks it into > an array of heterogenous objects all derived from that type, dynamically > dispatching to them. Note that "stop everything, rewrite the program, > recompile, and start up again" is not acceptable. Right, Ada is not designed for this. Although the distributed annex comes close; you could change out a partition without restarting the other partitions. You can also get close via DLLs on Windows (and shared libraries on other OS's?), but not with full dispatching. > In scripting languages, this is done all the time. Perhaps there is a better term for this than "scripting language". For example, Java has this capability, and it is _not_ a "scripting language" by your definition (at least, I don't think it is :). Lisp has this feature; is that a "scripting language"? And Ada compiled to the JVM would have this capability; that would be interesting to play with. Perhaps "dynamic code loading" is a good phrase for this feature. > How would you do it in Ada? I don't believe that "save the state of the > currently running program and invoke a new program so it starts up in the > same place as the old one" can be made an Ada library. For some set of Ada programs, you can clearly do this. Not for an arbitrary one. Perhaps not for interesting programs :). > If it can, that would be really cool, because it would solve a > problem I've been thinking about for a while in an unrelated field. > But I haven't figured out any way of doing that without knowing what > part of the program constitutes the "current state". I gather you want the "save the state" operation to be provided by the compiler, not by the programmer. I guess that is true in the languages that have "dynamic code loading". Clearly, if the user provides it, you can solve a wider range of problems. > There's a tremendous difference between linking to DLLs, generating > code on the fly, and the "exec" system call. Agreed. -- -- Stephe