Zsh Mailing List Archive
Messages sorted by:
Re: PATCH: user-defined math functions
- X-seq: zsh-workers 22422
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: user-defined math functions
- Date: Wed, 19 Apr 2006 17:04:05 +0100
- In-reply-to: Your message of "Wed, 12 Apr 2006 22:02:58 PDT." <1144904581.1C7F7561@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/
Messages sorted by: