From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Question about Elisp language abilities (evaluating expr on time of func definition and ability to construct function).
Date: Fri, 30 Sep 2011 00:33:17 +0300 [thread overview]
Message-ID: <j62o76$se5$1@dough.gmane.org> (raw)
I learn Elisp lang capability. According to
13.2 Expansion of a Macro Call
section of 'info elisp':
Evaluation of the macro call begins like evaluation of a
function call except for one crucial difference: the macro
arguments are the actual expressions appearing in the macro
call. They are not evaluated before they are given to the
macro definition.
So Elisp macro executed when func called, but with different algorithm
of args passing. This allow make "new" language constructions but
I know about more powerful abilities.
Is there any Elisp special form which evaluate args when 'defun' parsed
(like words which defined with IMMEDIATE marker in Forth prog lang)?
In Forth in time of processing of word definition compiler can pass
control to interpreter when encounter special word until they decide
back to compilation process.
So in similar construction exist in Elisp this hypothetical code:
(defun f (x)
(IMMEDIATE (message "hello!"))
(1+ x)
)
on 'f' compilation stage print "hello" and never do this on 'f'
evaluation.
Another question is there ability to construct function on the fly.
For example:
(GENFUNC get-parser (syntax-tree) (data)
...
)
syntax-tree is a string, data is free argument. When you call
(get-parser "a=a|ab; b=*")
you get function with one argument (remember 'data'?) which constructed
dynamically and can perform parsing very speedily
(as 'get-parser' can be more fast then general purpose parser
as it know 'syntax-tree' on construction stage).
next reply other threads:[~2011-09-29 21:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 21:33 Oleksandr Gavenko [this message]
2011-09-29 22:14 ` Question about Elisp language abilities (evaluating expr on time of func definition and ability to construct function) Oleksandr Gavenko
2011-09-29 22:45 ` Oleksandr Gavenko
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='j62o76$se5$1@dough.gmane.org' \
--to=gavenkoa@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).