From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5448 invoked from network); 19 Apr 2006 16:04:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Apr 2006 16:04:29 -0000 Received: (qmail 15602 invoked from network); 19 Apr 2006 16:04:24 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Apr 2006 16:04:24 -0000 Received: (qmail 3130 invoked by alias); 19 Apr 2006 16:04:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22422 Received: (qmail 3120 invoked from network); 19 Apr 2006 16:04:20 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 Apr 2006 16:04:20 -0000 Received: (qmail 15336 invoked from network); 19 Apr 2006 16:04:20 -0000 Received: from mta07-winn.ispmail.ntl.com (HELO mtaout01-winn.ispmail.ntl.com) (81.103.221.47) by a.mx.sunsite.dk with SMTP; 19 Apr 2006 16:04:18 -0000 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20060419160416.PAJG29343.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Wed, 19 Apr 2006 17:04:16 +0100 Received: from pwslaptop.csr.com ([81.107.43.247]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20060419160416.UAGQ16086.aamtaout04-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Wed, 19 Apr 2006 17:04:16 +0100 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.4/8.13.4) with ESMTP id k3JG48bk007471 for ; Wed, 19 Apr 2006 17:04:08 +0100 Received: from pwslaptop.csr.com (pws@localhost) by pwslaptop.csr.com (8.13.4/8.13.4/Submit) with ESMTP id k3JG45su007468 for ; Wed, 19 Apr 2006 17:04:07 +0100 Message-Id: <200604191604.k3JG45su007468@pwslaptop.csr.com> X-Authentication-Warning: pwslaptop.csr.com: pws owned process doing -bs From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: user-defined math functions In-Reply-To: Your message of "Wed, 12 Apr 2006 22:02:58 PDT." <1144904581.1C7F7561@fb4.dngr.org> Date: Wed, 19 Apr 2006 17:04:05 +0100 Barton Schaefer wrote: > Use typeset? Currently I think the -i/-E/-F options cannot be combined > with -f. Allow them to be, and have them create math functions with the > corresponding return types. I'm not convinced that gains you much... Overloading typeset doesn't make for a very clear interface, which is presumably why autoload +/-X are seperate and not done via typeset -fu (= functions -u). As currently written, the return value is self-typing, since (( 1 )) and (( 1.0 )) are represented by different members of a discriminated union. Coercing the return value to integer or floating point via the interface rather than the implementation function therefore doesn't seem to me to gain much, either. Since it's the value that's important, not the representation -E and -F numbers are equivalent at this point. (It's a bit different at when calling the function because of the array problem, but it still uses as many floating point digits as it can to reduce the effect of truncation.) Further, since the functions are only used within an expression, the output representation wouldn't be used at the point where the function's value is. I think I'll just commit what I've currently got... I've tweaked a few tests for safety in functions -M as well as the documentation. Mixed in with the patch are some tweaks I made to add some styles to pick-web-browser which aren't likely to be of earth-shattering general interest. -- Peter Stephenson Web page still at http://www.pwstephenson.fsnet.co.uk/