zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Phil Pennock <phil@athenaeum.demon.co.uk>, zsh-workers@math.gatech.edu
Subject: Re: PATCH: Docs out of sync
Date: Fri, 11 Dec 1998 23:45:19 -0800	[thread overview]
Message-ID: <981211234519.ZM23754@candle.brasslantern.com> (raw)
In-Reply-To: <19981209194311.62754@athenaeum.demon.co.uk>

On Dec 9,  7:43pm, Phil Pennock wrote:
} Subject: PATCH: Docs out of sync
}
} Typing away merrily, Peter Stephenson produced the immortal words:
} > Phil Pennock wrote:
} > > * bash has arrays.  'declare', 'local' & 'readonly' each accept '-a' to
} > >   declare an array.  Is it reasonable to add '-a' to 'typeset'?  This
} > >   would automatically duplicate the bash-ism.
} > 
} > It's not exactly essential, since bash and zsh have rather different
} > extensions to sh in any case.  They're only similar in as much as they
} > both include sh.  It's hard enough keeping ksh emulation working.
} 
} Looking through the source for 3.1.5-patched, bin_typeset et al accept
} -a.  This is undocumented.  This functionality is not in 3.1.5.
} With no arguments beyond the options, "typeset -a" scans the parameter
} table for arrays.  "typeset -A" scans for hashes.  An added bonus!  ;^)

It was actually typeset -A that I was adding, and -a was the bonus.

} Except that "typeset -a foo" is silently ignored.  An unhandled case
} later on.

It's an unhandled case because the code (from prior to my patch) has an
explicit 	on &= ~PM_ARRAY;	in the loop that creates the
parameters when they don't already exist.  I think that's there because
the syntax	typeset array=(x y z)	doesn't make it through the
parser, but I don't know for sure so I didn't mess with it.

Anyway, it's not correct to say that `typeset -a foo` is ignored -- it
DOES create the parameter foo, but it creates it as a scalar, not as an
array, which is exactly what used to happen with `typeset foo=(x y z)`
before (x y z) started being interpreted as a glob modifier.  (Now it
says "unknown file attribute" and fails entirely.)

} Scanning back, Bart added this functionality in patch 4608 (Nov 12).
} It was documented in the article, but no docs patch.  The options to
} 'local' were also modified.

I didn't give a doc patch because none of this stuff is stable yet; the
syntax may change, etc.  (Though `typeset -A` is unlikely to change, as
it's ksh compatible.)

} Docs patch included at end of this article.

Thanks, but ...

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      reply	other threads:[~1998-12-12  7:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-09  3:25 Notes on bash(1) Phil Pennock
1998-12-09  9:01 ` Peter Stephenson
1998-12-09 17:04   ` PATCH: 3.1.5: bash ${.../old/new} Peter Stephenson
1998-12-10 15:52     ` Strange substring search behaviour Peter Stephenson
1998-12-09 19:43   ` PATCH: Docs out of sync Phil Pennock
1998-12-12  7:45     ` Bart Schaefer [this message]

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=981211234519.ZM23754@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=phil@athenaeum.demon.co.uk \
    --cc=zsh-workers@math.gatech.edu \
    /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).