zsh-workers
 help / color / mirror / code / Atom feed
* (Fwd) Re: Value of $0
@ 2001-08-06 14:46 Bart Schaefer
  2001-08-06 15:30 ` Oliver Kiddle
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-08-06 14:46 UTC (permalink / raw)
  To: zsh-workers

Another way zsh doesn't quite emulate ksh, just FYI.

--- Forwarded mail from David Korn <dgk@research.att.com>

Date: Sun, 5 Aug 2001 23:06:41 -0400 (EDT)
From: David Korn <dgk@research.att.com>
To: shell@research.att.com
Subject: Re: Value of $0


POSIX treats functions as macros so it does not redefine $0. 
The conform, $0 must remain the name of the shell or script, not
the function name.  I had to change ksh93 to conform since ksh88
hade $0 be the function name.

This is one of the reasons that ksh has stuck with the function name()
syntax.  These functions have scoping and behave more like shell
scripts than macros.  $0 is defined as the name of the function
for function name() functions.

Also, set -x causes each line of a function to be traced with the POSIX
shell.  Using function name() in ksh93 does not do this and you
can set the trace attribute individually for each function using
	typeset -ft name

David Korn
research!dgk
dgk@research.att.com
____________________________________________________________
To unsubscribe from this list, please send the following
two-line message to majordomo@research.att.com, in which
your_email_address should be replaced by the address you
used when you subscribed to the list:
unsubscribe shell your_email_address
end


---End of forwarded mail from David Korn <dgk@research.att.com>

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: (Fwd) Re: Value of $0
  2001-08-06 14:46 (Fwd) Re: Value of $0 Bart Schaefer
@ 2001-08-06 15:30 ` Oliver Kiddle
  2001-08-07 16:16   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2001-08-06 15:30 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
> 
> Another way zsh doesn't quite emulate ksh, just FYI.

Shouldn't we keep a list of all these things which are coming up that
might need changes to zsh. So far, there has been at least this,
redirections in function definitions, bash and ksh's options to exec and
emulate should setopt nocorrect. We could keep a list in a file on cvs
and leave the file out of .distfiles.

Oliver


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

* Re: Value of $0
  2001-08-06 15:30 ` Oliver Kiddle
@ 2001-08-07 16:16   ` Bart Schaefer
  2001-08-07 17:50     ` Oliver Kiddle
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-08-07 16:16 UTC (permalink / raw)
  To: zsh-workers

On Aug 6,  4:30pm, Oliver Kiddle wrote:
}
} > Another way zsh doesn't quite emulate ksh, just FYI.
} 
} Shouldn't we keep a list of all these things which are coming up that
} might need changes to zsh. [...] We could keep a list in a file on cvs
} and leave the file out of .distfiles.

I've created the file Etc/STD-TODO for this purpose.  Presently I have it
in two sections, "Syntax and Parsing" and "Semantics".  I put "noglob"
and "nocorrect" under semantics with the rest of the precommand modifiers,
though I suppose they could belong under syntax.

} emulate should setopt nocorrect.

It's actually worse than that.  (Emulation does setopt nocorrect, or at
least does not setopt correct.)  The special meanings of "nocorrect" and
"noglob" should be disabled in emulation.  It's not a serious problem,
as it's unlikely that an external command or function would have one of
those names, but it's worth pointing out.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: Value of $0
  2001-08-07 16:16   ` Bart Schaefer
@ 2001-08-07 17:50     ` Oliver Kiddle
  2001-08-07 18:03       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2001-08-07 17:50 UTC (permalink / raw)
  To: zsh-workers

Peter wrote:
| > Or if that would cause problems, some sort of similar way such
| > as an option to functions or autoload?
| Or maybe an addition to zsh/parameter.

That would do the job nicely.

Bart Schaefer wrote:
> 
> I've created the file Etc/STD-TODO for this purpose.

Looks good.

> It's actually worse than that.  (Emulation does setopt nocorrect, or at
> least does not setopt correct.)  The special meanings of "nocorrect" and
> "noglob" should be disabled in emulation.

ok, so emulate should disable noglob and nocorrect then.

I just noticed a silly bug in _enable which was my fault some while ago
so fix is below.

I'll also just add `_value:DISPLAY() _x_display' in _value. Are braces
needed for any option combination because it works without regardless of
shortloops.

Oliver

Index: Completion/Zsh/Context/_value
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_value,v
retrieving revision 1.1
diff -u -r1.1 _value
--- Completion/Zsh/Context/_value       2001/04/02 11:25:06     1.1
+++ Completion/Zsh/Context/_value       2001/08/07 17:48:39
@@ -58,4 +58,6 @@
   fi
 }
 
+_value:DISPLAY() _x_display
+
 _value "$@"

Index: Completion/Zsh/Command/_enable
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_enable,v
retrieving revision 1.1
diff -u -r1.1 _enable
--- Completion/Zsh/Command/_enable      2001/04/02 11:28:14     1.1
+++ Completion/Zsh/Command/_enable      2001/08/07 17:48:39
@@ -5,4 +5,4 @@
   "(-a -r)-f[act on functions]:*:functions:(${(k)dis_functions})" \
   "(-a -f)-r[act on reserved
words]:*:reserved-words:(${(k)dis_reswords})" \
   '-m[treat arguments as patterns]' \
-  "*:builtin command:(${(@k)dis_builtins})"
+  "*:builtin command:(${(k)dis_builtins})"

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp


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

* Re: Value of $0
  2001-08-07 17:50     ` Oliver Kiddle
@ 2001-08-07 18:03       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2001-08-07 18:03 UTC (permalink / raw)
  To: zsh-workers

On Aug 7,  6:50pm, Oliver Kiddle wrote:
}
} > It's actually worse than that.  (Emulation does setopt nocorrect, or at
} > least does not setopt correct.)  The special meanings of "nocorrect" and
} > "noglob" should be disabled in emulation.
} 
} ok, so emulate should disable noglob and nocorrect then.

The problem there is that almost everything else done by "emulate" can be
undone with "setopt".  (There are a couple of exceptions, I know.)

} I just noticed a silly bug in _enable which was my fault some while ago
} so fix is below.
} 
} I'll also just add `_value:DISPLAY() _x_display' in _value.

Shouldn't that be

	_value:DISPLAY() { _x_display "$@" }

just so we don't need to edit _value in case _x_display starts paying
attention to its positionals?

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

end of thread, other threads:[~2001-08-07 18:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-06 14:46 (Fwd) Re: Value of $0 Bart Schaefer
2001-08-06 15:30 ` Oliver Kiddle
2001-08-07 16:16   ` Bart Schaefer
2001-08-07 17:50     ` Oliver Kiddle
2001-08-07 18:03       ` Bart Schaefer

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