From: "Jim Blandy" <jimb@red-bean.com>
To: "Paul Koning" <Paul_Koning@dell.com>
Cc: tromey@redhat.com, bauerman@br.ibm.com, gdb@sourceware.org
Subject: Re: repo to work on python scripting support
Date: Wed, 26 Mar 2008 22:45:00 -0000 [thread overview]
Message-ID: <8f2776cb0803261536r568dcbecpa8b6c6a1a6ffb622@mail.gmail.com> (raw)
In-Reply-To: <18410.23162.503583.519896@gargle.gargle.HOWL>
On Wed, Mar 26, 2008 at 7:15 AM, Paul Koning <Paul_Koning@dell.com> wrote:
> It seems to me that there's an attempt here to treat Python as if it
> were Elisp. But it isn't, and it isn't similar.
You're right, Python and Emacs Lisp are not the same, and we shouldn't
thoughtlessly adapt ideas from Emacs Lisp to GDB Python.
However, Emacs does have a similar situation to the one we have
here, in that Emacs commands are simultaneously:
- ordinary Emacs Lisp functions callable from Lisp, and
- interactive commands that can be bound to keys or invoked by name,
and when this happens need to prompt or otherwise gather their
arguments appropriately.
This is directly analogous to what we're doing with GDB. We want user
commands and functions to be simultaneously:
- Python functions (or at least objects) that can be used in the
ordinary fashion in Python code, and
- either commands that can be typed at the (gdb) prompt, or functions
that can be used in GDB expressions using the $(FUNC ARGS) syntax.
So I think it's a sound analogy that rests on the novel uses to which
we're putting functions, not on anything specific to Emacs Lisp.
> In Python, the caller picks the type of the arguments (implicitly, by
> picking the variables and expressions in the call). The called
> function then either examines what it received and converts as needed,
> or assumes that what it got was what it wanted and uses exceptions to
> convert as needed, etc.
I'm proposing we continue to use Python in exactly this way.
> If you add decorations of some sort, or magical methods in classes, to
> do Elisp-style argument mapping, a Python programmer is going to look
> at that and say "what language is this?"
Have you written code in Emacs Lisp? It sounds like you've gotten the
impression that what's going on is much more magic and involved than
it really is.
It's possible to write Emacs Lisp functions that work like the Python
code you posted that checks arguments against None and prompts for
them if needed. They would work fine, and interactive users wouldn't
be able to distinguish them from ordinary Emacs commands.
But Emacs Lisp coders don't write their functions this way:
- They would lose error checking when calling their functions from
Lisp: if they forget an argument to the function, the function will
prompt interactively instead of raising an error.
- They would lose the ability to use optional arguments in the way one
usually does --- when there's an obvious or useful default, or for
backwards compatibility. Instead of using default values, the
function would have to prompt for their values interactively.
- Interactive specs are often terser, and because they're an idiom
they're a little easier to read.
next prev parent reply other threads:[~2008-03-26 22:36 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-16 0:42 Thiago Jung Bauermann
2008-03-16 2:55 ` Tom Tromey
2008-03-24 17:16 ` Thiago Jung Bauermann
2008-03-25 11:45 ` Tom Tromey
2008-03-25 13:53 ` Daniel Jacobowitz
2008-03-25 18:37 ` Jim Blandy
2008-03-25 18:52 ` Daniel Jacobowitz
2008-03-25 18:53 ` Jim Blandy
2008-03-25 19:18 ` Tom Tromey
2008-03-27 6:41 ` Jim Blandy
2008-03-27 17:57 ` Paul Koning
2008-03-25 19:31 ` Paul Koning
2008-03-25 20:18 ` Tom Tromey
2008-03-25 20:31 ` Paul Koning
2008-03-26 3:23 ` Tom Tromey
2008-03-26 12:55 ` Jim Blandy
2008-03-26 17:29 ` Paul Koning
2008-03-26 17:58 ` Daniel Jacobowitz
2008-03-26 18:41 ` Tom Tromey
2008-03-26 20:04 ` Paul Koning
2008-03-26 22:45 ` Jim Blandy [this message]
2008-03-26 18:05 ` Doug Evans
2008-03-26 18:13 ` Daniel Jacobowitz
2008-03-26 18:25 ` Tom Tromey
2008-03-26 18:41 ` Daniel Jacobowitz
2008-03-26 18:55 ` Tom Tromey
2008-03-26 20:57 ` Daniel Jacobowitz
2008-03-26 21:01 ` Thiago Jung Bauermann
2008-03-27 14:11 ` Jim Blandy
2008-03-27 16:49 ` Paul Koning
2008-03-26 18:23 ` Tom Tromey
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=8f2776cb0803261536r568dcbecpa8b6c6a1a6ffb622@mail.gmail.com \
--to=jimb@red-bean.com \
--cc=Paul_Koning@dell.com \
--cc=bauerman@br.ibm.com \
--cc=gdb@sourceware.org \
--cc=tromey@redhat.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox