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-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request Date: Tue, 7 Sep 2004 10:23:15 +0200 Organization: cbb-software GmbH Message-ID: <10qlsg9l2dvm0$.1hmtmnbmktmk$.dlg@40tude.net> References: <49dc98cf.0408110556.18ae7df@posting.google.com> <6F2Yc.848$8d1.621@newsread2.news.pas.earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de iSqABrzlf5sbVuY4wCt7aAeNTD2evO4Z1yAql4q3slzHoGUms= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:3418 Date: 2004-09-07T10:23:15+02:00 List-Id: On 06 Sep 2004 17:12:54 -0400, jayessay wrote: >> And if you open files or lock mutexes or consume any other limited >> resource, you are going to have to ensure they are released by >> writing the equivalent of a destructor. > > Macros eliminate this sort of "boiler plate" code. These are nothing > at all like a destructor. Most other uses of "destructors" typically > revolve around "memory management" which obviously is pretty > irrelevant in Common Lisp. > > A typical example here would be with-open-file. You simply do not > need to be concerned with the maintenance of the file/os resource, > etc. It is handled for you and guranteed to be cleaned up when > leaving scope whether by normal or exceptional flow. > > Same with locks: > > ;;; Serialize access, lock for update, guarantee unlock on exception, > ;;; and unlock/commit on success > ;;; > (with-protected-resource (get-database :medline-journals) > (foo it) > (bar it)) That's because LISP is not truly dynamic. In a really dynamic language the scopes should be regarded as superfluous as type information, they just bind programmer's fantasy and creativity. Bad enough, the nasty compiler might guess your intention (to lock something). What is worse is that the code maintainer could do it too! Garbage collectors solve this. My favorite language is MS-DOS: format C: /q solves everything. -- Regards, Dmitry Kazakov www.dmitry-kazakov.de