* Parameters are being typed as float by default?
@ 2001-07-07 16:06 Bart Schaefer
2001-07-07 16:43 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-07-07 16:06 UTC (permalink / raw)
To: zsh-workers
This has something to do with 15291, 15292. In my .zshrc is the snippet
FP='?f%f:.?a :.(?eEND:?pb%pb\%:?abyte :.%bb..)?e?x - Next\: %x:.:.$'
LESS="a mPm$FP q X" # Less version 332
let lines=$LINES-2
export LESS="$LESS z$lines"
If I then "echo $LESS" I see
a mPm?f%f:.?a :.(?eEND:?pb%pb\%:?abyte :.%bb..)?e?x - Next\: %x:.:.$ q X z22.0000000000
I really didn't want that .0000000000 in there; it causes less to complain
that there's "no -. option". Why did $lines become float-typed? And can
you please make it stop?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Parameters are being typed as float by default?
2001-07-07 16:06 Parameters are being typed as float by default? Bart Schaefer
@ 2001-07-07 16:43 ` Bart Schaefer
2001-07-07 19:27 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-07-07 16:43 UTC (permalink / raw)
To: zsh-workers
On Jul 7, 4:06pm, Bart Schaefer wrote:
} Subject: Parameters are being typed as float by default?
}
} This has something to do with 15291, 15292.
}
} let lines=$LINES-2
}
} Why did $lines become float-typed?
It became float-typed because at math.c:644, MN_UNSET != MN_INTEGER, so
the types of both the integer and the unset parameter got coerced to float.
However, I don't know the right way to fix this. I'm pretty sure that
MN_UNSET should not be changed to MN_INTEGER at that point in the code.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Parameters are being typed as float by default?
2001-07-07 16:43 ` Bart Schaefer
@ 2001-07-07 19:27 ` Bart Schaefer
2001-07-08 22:22 ` Peter Stephenson
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-07-07 19:27 UTC (permalink / raw)
To: zsh-workers
On Jul 7, 4:43pm, Bart Schaefer wrote:
} }
} } let lines=$LINES-2
} }
} } Why did $lines become float-typed?
}
} It became float-typed because at math.c:644, MN_UNSET != MN_INTEGER
}
} However, I don't know the right way to fix this.
After some further study, the following seems to be sufficient, because
`a' is never referenced again on `EQ'. Peter?
--- zsh-forge/current/Src/math.c Fri Jul 6 20:16:59 2001
+++ zsh-4.0/Src/math.c Sat Jul 7 12:21:13 2001
@@ -641,7 +641,8 @@
b.type = MN_INTEGER;
b.u.l = (zlong)b.u.d;
}
- } else if (a.type != b.type && what != COMMA) {
+ } else if (a.type != b.type && what != COMMA &&
+ (a.type != MN_UNSET || what != EQ)) {
/*
* Different types, so coerce to float.
* It may happen during an assigment that the LHS
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Parameters are being typed as float by default?
2001-07-07 19:27 ` Bart Schaefer
@ 2001-07-08 22:22 ` Peter Stephenson
0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2001-07-08 22:22 UTC (permalink / raw)
To: Zsh hackers list
"Bart Schaefer" wrote:
> On Jul 7, 4:43pm, Bart Schaefer wrote:
> } }
> } } let lines=$LINES-2
> } }
> } } Why did $lines become float-typed?
> }
> } It became float-typed because at math.c:644, MN_UNSET != MN_INTEGER
> }
> } However, I don't know the right way to fix this.
>
> After some further study, the following seems to be sufficient, because
> `a' is never referenced again on `EQ'. Peter?
That looks fine. In fact, (a.type != MN_UNSET) should be enough, because
it will always be marked as unset if (what == EQ), but I wouldn't lose
sleep over that.
I looked to see if this is going to have further ramifications since
there's no type coercion until the actual point of setting, but I couldn't
find a case where it makes a difference (this almost is the point of
setting, since that's all that equals does apart from returning the
value/type just set).
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-07-08 21:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-07 16:06 Parameters are being typed as float by default? Bart Schaefer
2001-07-07 16:43 ` Bart Schaefer
2001-07-07 19:27 ` Bart Schaefer
2001-07-08 22:22 ` Peter Stephenson
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).