[m-users.] Impurity needed?

Mark Brown mark at mercurylang.org
Thu Feb 23 12:26:53 AEDT 2023


On Wed, Feb 22, 2023 at 4:36 PM Volker Wysk <post at volker-wysk.de> wrote:
>
> Am Mittwoch, dem 22.02.2023 um 03:23 +1100 schrieb Mark Brown:
> > On Wed, Feb 22, 2023 at 12:23 AM Volker Wysk <post at volker-wysk.de> wrote:
> > > So you think it would be okay to add the IO state to transactions in the
> > > ODBC library? Such that IO in a transaction would be allowed? Of course the
> > > programmer needs to be pointed to the fact that his IO actions can't be
> > > backtracked.
> > >
> > > Zoltan said this was a very bad idea...
> >
> > Right, it would be unsafe in much the same way as unsafe_{get,set}_io,
> > except the user's code wouldn't need to mention "unsafe" anywhere.  A
> > better solution would be to use those as needed, which would at least
> > alert people to the issue even if it can't be checked.
>
> Maybe make two predicates: called "transaction" and "unsafe_transaction".
> With only the latter allowing IO.

I wouldn't object.  It's much the same decision as whether to
advertise unsafe_{get,set}_io, though we often aren't as strict with
these sorts of things when it's not the std library.

Would it be possible to specify a small set of I/O operations that can
be guaranteed safe?  E.g., reading from a file seems ok.  If so it may
be possible to define a safe transaction that allows this, by
providing an abstract odbc_io type that is passed to the user code and
can forward file reads, or whatever, to the io module.  Do you think
that would make sense (or are there holes I haven't thought of)?

Cheers,
Mark

>
>
> Cheers, Volker
>
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users


More information about the users mailing list