On Thu, Jul 30, 2020 at 4:25 PM Jessica Clarke <jrtc27_at_freebsd.org> wrote: > > On 30 Jul 2020, at 23:21, Jessica Clarke <jrtc27_at_freebsd.org> wrote: > > On 30 Jul 2020, at 20:35, Gavin Howard <gavin.d.howard_at_gmail.com> wrote: > >> > >> Hello, > >> > >> My name is Gavin Howard, and I am the developer and maintainer of the > >> new bc and dc implementation in -CURRENT. Stefan Eßer brought a > >> discussion about my bc to my attention, and I would like to solve the > >> problems. > >> > >> First, I will add some way to remove the printing of the copyright > >> header at compile time, and FreeBSD should be able to take advantage > >> of it as soon as I put out a new release, which should be within days > >> after this discussion is settled. > >> > >> Second, there seems to be those who are unhappy with my decision to > >> make bc and dc not exit when using the -e and -f options. While the > >> behavior of my bc is what I personally need, I have a few options to > >> change it back to what is expected: > >> > >> 1. I could make it a compile-time selection. I don't like this option, > >> to be honest. > >> > >> 2. I could restore the expected behavior of -e and -f and change the > >> environment variable to BC_EXPR_NO_EXIT (DC_EXPR_NO_EXIT) and reverse > >> the logic. I could do this one, but Stefan mentioned to me that he > >> would prefer less environment variables be used. I agree. > >> > >> 3. I could restore the expected behavior of -e and -f and add -E and > >> -F options that do the same thing but do not exit. I think I like this > >> option the best. I am willing to change -E and -F to something else if > >> that would be better. > > > > Rather than introducing new options like any of these you could instead: > > > > 4. Make sure -f - reads from stdin. Then just append -f - to your uses. > > > > 5. Overload -i when used with -e/-f to also make it not exit. > > > > I personally prefer 4 as it doesn't require any confusing overloading > > (-f - should read from stdin as a well-behaved Unix tool regardless in > > my opinion), but does come with the downside that you can't just: > > > > alias bc='bc -f -' > > > > for your case, you'd have to instead: > > > > bc() { command bc "$_at_" -f - } > > > > or equivalent in your shell of choice. > > NB: 4 already works with GNU dc. FreeBSD's old dc requires you to do -f > /dev/stdin instead as it doesn't treat - as special but otherwise also > works. I haven't looked to see whether your dc regards - as stdin or > not, but -f /dev/stdin surely already works. So 4 seems the most > consistent and/or compatible option when considering other > implementations. > > Jess All, I have made the following changes: bc does not print a copyright header unless the version options (-v, -V, and --version) are given. The -q and --quiet options are no-ops, but are kept for compatibility with GNU bc. I have ensured that -f - works; it basically disables exiting after processing all expressions and files given with -e and -f. I have found a way to make this work for me personally. If there are no objections within 24 hours or so, I will release the changes as 3.1.4. Gavin HowardReceived on Fri Jul 31 2020 - 00:37:23 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:24 UTC