zsh-workers
 help / color / mirror / code / Atom feed
* special/readonly variables in sh emulation
@ 2002-03-18 12:56 Oliver Kiddle
  2002-03-18 14:07 ` Peter Stephenson
  0 siblings, 1 reply; 11+ messages in thread
From: Oliver Kiddle @ 2002-03-18 12:56 UTC (permalink / raw)
  To: zsh-workers

I've recently set /bin/sh to be zsh on my Debian Linux box to see what
if any problems occur.

The only problem with the init scripts was this:
/etc/rcS.d/S45mountnfs.sh:29: options: attempt to set slice of associative array

The offending line is:
   while read device mountpt fstype options

Everything else was fine including several configure scripts until I
tried to configure, of all things, zsh:

./configure:10594: functions: attempt to set slice of associative array

We perhaps ought to rethink the status of any special variables
in sh emulation mode. Especially those which are autoloaded out of
places like zsh/parameter. Any ideas on how to solve this?

Oliver
-- 

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: special/readonly variables in sh emulation
@ 2002-04-03 14:57 Oliver Kiddle
  0 siblings, 0 replies; 11+ messages in thread
From: Oliver Kiddle @ 2002-04-03 14:57 UTC (permalink / raw)
  To: zsh-workers

Bart wrote:
>
> } Should we allow attributes like uppercase and integer to apply across
> } an array like in ksh (this is messier for hashes as each element has
> } its own param)?
> 
> I don't know what the ksh implementation of this is like -- does it apply
> the conversion at fetch time, or at assign time?

Assign time it seems - fetch time would be better in my opinion. The
ksh feature which I was refering to and which I like is:
  $ a=(one two three)
  $ typeset -u a
  $ echo ${a[@]}
  ONE TWO THREE
And similarly for other typeset options such as -i.

And thanks for answering the various questions.

> The way I would structure this is:
> 
> The lowest-level API provides functions to set and get scalars (strings,
> ints, etc.), arrays, array elements, and associative array elements
> (including getting the keys or values).
> 
> An intermediate API provides functions implemented in terms of the above
> to set and get string ranges, array slices, and arrays of associative
> array elements.  Special parameters have the option of implementing only
> the lowest-level API and using the functions from the intermediate one,
> or of providing the intermediate ones for efficiency or other effects.

Ok, that is roughly what the patch I posted was heading towards though
I'm entirely happy with it. To support the specials overriding the
intermediate API you get a fairly big method table. Simple specials
would use the default methods. Unless anyone can think of a better
system than the method tables or come up with a better, more generic
version of the paramdef struct system for setting up specials?

> The complication arises when we add in nested substitutions, where the
> result of an inner substitution has to be treated as a parameter value
> for purposes of outer substitutions.  I suggest we actually create a
> dummy parameter in this case rather than trying to handle everything via
> manipulation of the Value structure -- but that means some pretty heavy
> rewriting of paramsubst() and getarg().

A dummy param might be good. I was sort of hoping to get rid of the
value struct and use start/end ints where necessary but another option
might be a dummy param there to.

> If we did create a dummy parameter, we could even give it a name and
> let the surrounding substitutions refer to it explicitly, e.g.:
> 
> 	... ${$(some command):+blah blah $_ blah blah} ...

That's an interesting idea.

> I haven't looked at your patch in detail yet, but these seems like things
> that could go in the optional intermediate-level API.

It would be useful if someone could look at it just a little bit. What
I'm least sure of is what is needed to support associative specials
properly.

I've not done anything on this since last week - I was away for the
Easter bank holidays.

Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-04-03 14:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-18 12:56 special/readonly variables in sh emulation Oliver Kiddle
2002-03-18 14:07 ` Peter Stephenson
2002-03-18 15:41   ` Oliver Kiddle
2002-03-19  1:43     ` Bart Schaefer
2002-03-20 12:55       ` Oliver Kiddle
2002-03-20 13:53         ` Peter Stephenson
2002-03-20 17:41           ` Oliver Kiddle
2002-03-26 11:09           ` Oliver Kiddle
2002-03-26 16:55             ` Bart Schaefer
2002-03-19 11:27     ` Peter Stephenson
2002-04-03 14:57 Oliver Kiddle

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).