zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: user-defined math functions
Date: Wed, 19 Apr 2006 17:04:05 +0100	[thread overview]
Message-ID: <200604191604.k3JG45su007468@pwslaptop.csr.com> (raw)
In-Reply-To: Your message of "Wed, 12 Apr 2006 22:02:58 PDT." <1144904581.1C7F7561@fb4.dngr.org>

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 <p.w.stephenson@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/


  reply	other threads:[~2006-04-19 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-13  5:02 Barton Schaefer
2006-04-19 16:04 ` Peter Stephenson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-04-11 18:25 Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604191604.k3JG45su007468@pwslaptop.csr.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).