Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: local after setopt allexport?

On Aug 8, 10:50pm, Rik Faith wrote:
} Subject: Re: local after setopt allexport?
} If this is not a compatibility or historical practice issue, I'd like to
} suggest that the commands "local", "typeset", etc. all look like they are
} used to declare the "type" of a variable.  As such, it seems that
} "exportable" is a type attribute and that this attribute should be
} associated with a variable for the remainder of its lifetime (or until
} another typeset).

This is in fact what happens when `allexport' is NOT set.

} This could be implemented internally in zsh with a
} tri-state flag: +x for exportable, -x for local, and ?x for "use the
} current state of the allexport option".

It'd have to be +x for local, -x for exported, to be consistent with
existing usage.

I confess to be curious why:

	setopt allexport
	typeset +x FOO=bar

results in FOO being exported, whereas

	setopt allexport
	typeset +x FOO

results in FOO being local.  Does ksh really ignore the `+x' in the
first example?  (I should get pdksh so I can stop asking this stuff,
but then again, most of the time I don't *want* pdksh.)

Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"

Messages sorted by: Reverse Date, Date, Thread, Author