zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: use of rand() in zsh
Date: Tue, 11 Oct 2022 15:48:36 +0100 (BST)	[thread overview]
Message-ID: <112626329.2649601.1665499716807@mail.virginmedia.com> (raw)
In-Reply-To: <2fb79279-47c1-f3e1-3331-fb84966a6258@zentaur.org>


> On 11/10/2022 15:15 Clinton Bunch <cdbunch@zentaur.org> wrote:
> 
>  
> On 10/11/2022 8:23 AM, Peter Stephenson wrote:
> >> On 11/10/2022 13:51 Clinton Bunch <cdb_zsh@zentaur.org> wrote:
> >>
> >> 3. Write a module (e.g. zsh/random) that introduced a new special
> >> parameter when loaded (more complicated, but isolated to those who want
> >> it and possible to fail on systems that don't have a kernel entropy pool)
> > An autoloadable parameter gives you something that works basically as if
> > it's part of the shell but can be turned off as well as giving an error
> > if the module isn't available, so might be the best bet.  So the
> > .mdd file would have
> >
> > autofeatures=p:SRANDOM
> >
> > pws
> >
> That's a neat trick, but as someone who has had to hack to build 
> software built and primarily tested on Linux, on a Unix system stuck in 
> the '00's (if not the last century), I'd rather have an explicit 
> load/test for the existence of the module than have it blow up on a 
> system where SRANDOM didn't work. (8 years as an HP-UX admin)
> 
> My $.02 for whatever that's worth. :)

You can do that too: the autoload only triggers if you refer to
$SRANDOM first, at which point the module will fail to load ---
quite possibly in an inconvenient location.  But if you write
your code to do the load explicitly it will check at that point.
So you should have the best of all worlds.

pws


  reply	other threads:[~2022-10-11 14:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 23:32 Clinton Bunch
2022-10-11  1:14 ` Bart Schaefer
2022-10-11  1:27   ` Clinton Bunch
2022-10-11  1:32     ` Clinton Bunch
2022-10-11  3:34       ` Bart Schaefer
2022-10-11  3:44         ` Clinton Bunch
2022-10-11  6:31           ` Roman Perepelitsa
2022-10-11 12:51             ` Clinton Bunch
2022-10-11 13:23               ` Peter Stephenson
2022-10-11 14:15                 ` Clinton Bunch
2022-10-11 14:48                   ` Peter Stephenson [this message]
2022-10-11 12:35   ` Clinton Bunch
2022-10-11 13:18     ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=112626329.2649601.1665499716807@mail.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).