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,571930b4ff0bc1ee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-28 13:59:36 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!4.1.16.34!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed.cwix.com!sjc-peer.news.verio.net!news.verio.net!sea-read.news.verio.net.POSTED!not-for-mail Newsgroups: comp.lang.ada From: Brian Rogoff Subject: Re: Compile time executed functions In-Reply-To: Message-ID: References: <3AC03CCE.70E3C2D5@mida.se> <87ae67qdrv.fsf@deneb.enyo.de> <87lmprow3a.fsf@deneb.enyo.de> <874rweoo2p.fsf@deneb.enyo.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Wed, 28 Mar 2001 21:56:49 GMT NNTP-Posting-Host: 206.184.139.136 X-Complaints-To: abuse@verio.net X-Trace: sea-read.news.verio.net 985816609 206.184.139.136 (Wed, 28 Mar 2001 21:56:49 GMT) NNTP-Posting-Date: Wed, 28 Mar 2001 21:56:49 GMT Organization: Verio Xref: supernews.google.com comp.lang.ada:6173 Date: 2001-03-28T21:56:49+00:00 List-Id: On Wed, 28 Mar 2001, Robert A Duff wrote: > Ted Dennison writes: > > > After thinking about this some more, I'll go so far as to say that I don't think > > there are *any* languages that supply this capability. > > That's not correct. The Bliss language has a macro facility that can > use the full power of the language at compile time. Lisp macros also > allow the full power of Lisp at compile time. > > As you point out, this means that you can have infinite loops at compile > time. In practise, that's not a big deal: you deal with infinite > compile-time loops the same way as run-time ones. If you think the > thing is taking too long, you type control-C and investigate. Or if > you're doing a batch build, you set time-outs. Or you could have the > compiler count the number of iterations of each loop, and stop after > "too many". (After all, a very long loop is just as bad as an infinite > one.) That's just what C++ does with template instantiation, where the iteration limit is set to 17 I think. Before that, you could express arbitrary computations in the template language and do all sorts of interesting things at compile time. This aspect of the language was unintentional I think, but C++ programmers have been able to make good use of it. While I'm not generally fond of C++, this is actually one of those things about the language I find very interesting. I'd like to see these ideas explored in a future language that shed some of C++'s other baggage. Oh yeah, Mercury has a user defined iteration limit for resolving instances of polymorphic recursion, since they opted to try to infer the types of polymorphically recursive functions and that problem is undecidable. -- Brian