zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Jeff Solomon <jsolomon@stanford.edu>, zsh-workers@sunsite.auc.dk
Subject: Re: Zsh and Perl?
Date: Thu, 5 Aug 1999 05:39:49 +0000	[thread overview]
Message-ID: <990805053949.ZM15277@candle.brasslantern.com> (raw)
In-Reply-To: <14248.30740.258799.3140@mrclean.Stanford.EDU>

On Aug 4, 11:13am, Jeff Solomon wrote:
} Subject: Zsh and Perl?
}
} I think a common task that many people are faced with is writing
} little debugging tools. Frequently, they may write such a tool in a
} language like Perl because it's so time efficient.

You may very well be correct, but I'd like an example of such a tool if
you can share one.  I wouldn't have referred to any of the perl tools I
write as "debugging" tools, but perhaps you're speaking as an admin who
has to debug network connections or protocols, or the like.

I say this because ...

} So I'm asking the zsh developers about the best way to solve this
} problem. Basically I want to [...]

... you seem to have already made up your mind about the best way to solve
the problem, and I want to be convinced that you're right.  Marrying perl
to zsh isn't going to help people who write tools in awk or tcl or python.

For example, have you considered running the debugging tool as a coproc?

Nevertheless, to answer your specific questions ...

} Embed perl into zsh:
}     
}     Looking at the source, this looks like the most straightforward
}     thing to do. It seems easy to add a 'perl_eval' command that would 
}     evaluate a snippet of perl in a persistent interpreter. But I
}     would want to add command into the zsh enviroment from perl [...]

Zsh 3.1.6 modules are the thing for this.  For one thing, you can load
and unload them dynamically; so you don't have to bloat zsh permanently
with a perl interpreter, and you can force the interpreter to shut down
if necessary -- and with a lot of OOPerl programs, that's required to get
all the object cleanup to happen.

For another thing, as of 3.1.6 loadable modules can export zsh parameters,
so you can theoretically make the perl scalar namespace visible to zsh.
You might even be able to make (copies of) perl arrays visible, and bits
of perl hashes, though zsh doesn't have nested arrays/hashes.

Finally, of course, zsh modules were originally designed to supply new
builtin commands, and you can add as many as you like from each module.

} Embed zsh into perl:
} 
}     zsh is turned into a loadable perl module and I write a script
}     directly using zsh.

That would be a major engineering effort.  Perl has already gone through
the necessary transformations to become a linkable interpreter "library"; 
zsh has not, and I suspect it would be an ugly task to do so.

} Has anyone done this yet?

It's been mentioned a number of times, but nobody has ever been motivated
enough to go through with it.

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


  parent reply	other threads:[~1999-08-05  5:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-04 18:13 Jeff Solomon
1999-08-04 22:02 ` Bruce Stephens
1999-08-05  5:39 ` Bart Schaefer [this message]
1999-08-05  8:31 ` Peter Stephenson
1999-08-23 11:30 Mike Fletcher

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=990805053949.ZM15277@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=jsolomon@stanford.edu \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).