Re: bc and dc -e/-f and Copyright

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: bc and dc -e/-f and Copyright

Ravi Pokala-3
Hi Gavin,

Thanks for reaching out!

My primary concern is that `dc -e' returns to its previous auto-exit behavior. Any of the options you described would achieve that, and would be fine with me.

Thanks again,

Ravi (rpokala@)

-----Original Message-----
From: Gavin Howard <[hidden email]>
Date: 2020-07-30, Thursday at 12:35
To: <[hidden email]>, <[hidden email]>, <[hidden email]>, <[hidden email]>, <[hidden email]>, Stefan Esser <[hidden email]>
Subject: bc and dc -e/-f and Copyright

    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.

    When I presented these options to Stefan, he suggested that I ask you
    all for your opinions. I am also willing to consider other options
    that you might think of.

    Thank you for your time.

    Gavin Howard


_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: bc and dc -e/-f and Copyright

Gavin Howard
On Thu, Jul 30, 2020 at 4:25 PM Jessica Clarke <[hidden email]> wrote:

>
> On 30 Jul 2020, at 23:21, Jessica Clarke <[hidden email]> wrote:
> > On 30 Jul 2020, at 20:35, Gavin Howard <[hidden email]> 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 "$@" -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 Howard
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: bc and dc -e/-f and Copyright

Walter von Entferndt-2
In reply to this post by Ravi Pokala-3
Hi, innocent user here.
At Freitag, 31. Juli 2020, 14:00:00 CEST, Gavin Howard
<[hidden email]> wrote:
>     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
+1
This is the most intuitive & natural choice.
--
=|o) "Stell' Dir vor es geht und keiner kriegt's hin." (Wolfgang Neuss)


_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: bc and dc -e/-f and Copyright

Stefan Eßer
Am 31.07.20 um 19:44 schrieb Walter von Entferndt:
> Hi, innocent user here.
> At Freitag, 31. Juli 2020, 14:00:00 CEST, Gavin Howard
> <[hidden email]> wrote:
>>     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
> +1
> This is the most intuitive & natural choice.

An even better alternative has been suggested and implemented, I'm
waiting for that version to be tagged in the repository and will
then update our base version:

The -e and -f option will in general exit after all input has been
processed, but an additional "-f -" following those options will
allow to supply additional commands via stdin (and thus reproduce
the current behavior, if desired).

Regards, STefan
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[hidden email]"