* Confusing Error Message
@ 2012-03-14 0:43 Noah Lavine
2012-03-14 1:27 ` Ian Price
2013-01-16 18:10 ` Andy Wingo
0 siblings, 2 replies; 3+ messages in thread
From: Noah Lavine @ 2012-03-14 0:43 UTC (permalink / raw)
To: guile-devel
Hello,
I just got a confusing error while making a Guile module. I was
writing a module, and wanted to use the compile function - the one
that exists by default in the REPL environment. However, when I used
the compile function in a module and tried to load that module, I got
an unbound variable error for the name 'compile'!
After some checking, I discovered that 'compile is in the module
guile-user, so I tried importing that, but no luck. After some more
digging, I found that it's exported by (system base compile), and
importing that solved my problems.
However, I think this could have been very confusing to a new user.
It's not intuitive that a function that is available by default at the
REPL is not available in a module. I don't even know where to go to
look up what things are available in a module and what are not.
Was this limitation on purpose? If so, I'd like to know what's going
on so I can document it more. If not, there's a bug in the current
master.
Thanks,
Noah
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Confusing Error Message
2012-03-14 0:43 Confusing Error Message Noah Lavine
@ 2012-03-14 1:27 ` Ian Price
2013-01-16 18:10 ` Andy Wingo
1 sibling, 0 replies; 3+ messages in thread
From: Ian Price @ 2012-03-14 1:27 UTC (permalink / raw)
To: Noah Lavine; +Cc: guile-devel
Noah Lavine <noah.b.lavine@gmail.com> writes:
> Hello,
>
> I just got a confusing error while making a Guile module. I was
> writing a module, and wanted to use the compile function - the one
> that exists by default in the REPL environment. However, when I used
> the compile function in a module and tried to load that module, I got
> an unbound variable error for the name 'compile'!
Coincidentally, I also came across this during my current (as yet
unfinished) trek though the manual to find wrong and non-self contained
examples. (patches coming soon)
Section 10.4.1 describes the following "quine" that doesn't actually
work :)
((lambda (x) ((compile x) x)) ’(lambda (x) ((compile x) x)))
> However, I think this could have been very confusing to a new user.
> It's not intuitive that a function that is available by default at the
> REPL is not available in a module. I don't even know where to go to
> look up what things are available in a module and what are not.
I don't think there are that many included though: (ice-9 top-repl)
includes (ice-9 r5rs) (ice-9 session) (ice-9 regex) and (ice-9
threads). The define-module for (guile-user) at the bottom of boot-9.scm
also autoloads (system base compile)
I think (ice-9 threads) and (ice-9 regex) could be confusing for new
users; (ice-9 session) less so.
As for looking up: if a module is imported at the repl, then using the
",a" meta commmand is helpful, though you could just use "apropos" from
(ice−9 session) directly. Mostly I rely on geiser, which will display it
in emacs' minibuffer if my point is on the identifier, or I'll get the
info from C-c C-d C-d.
If the module isn't imported, the repl (and therefore geiser) is less
helpful, and I'll just search the manual.
> Was this limitation on purpose? If so, I'd like to know what's going
> on so I can document it more. If not, there's a bug in the current
> master.
I guess it is, NEWS says "Correctly written scripts load the modules
they require at the top of the file and should not be affected by this
change.", that's ages ago though -- "Changes since Guile 1.3.2:". Looks
to me like a case of "it's that way, because it's always been that way"
Just my £0.02.
--
Ian Price
"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Confusing Error Message
2012-03-14 0:43 Confusing Error Message Noah Lavine
2012-03-14 1:27 ` Ian Price
@ 2013-01-16 18:10 ` Andy Wingo
1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2013-01-16 18:10 UTC (permalink / raw)
To: Noah Lavine; +Cc: guile-devel
Hi Noah,
A question from a while back, but hey, an answer:
On Wed 14 Mar 2012 01:43, Noah Lavine <noah.b.lavine@gmail.com> writes:
> It's not intuitive that a function that is available by at the REPL is
> not available in a module. [referring to `compile']
There are a few more things that are like this, FWIW: (ice-9 top-repl)
loads the following modules into (guile-user) (but not (guile)):
(ice-9 r5rs)
(ice-9 session)
(ice-9 regex)
(ice-9 threads)
> I don't even know where to go to look up what things are available in
> a module and what are not.
,apropos is a good one.
> Was this limitation on purpose?
Yes. Loading `compile' loads the compiler and a bunch of other things.
It's something you would like to avoid doing for programs that don't
invoke the compiler. OTOH it is convenient to have at the REPL. For
that reason it's an autoload, but only in (guile-user).
> If so, I'd like to know what's going on so I can document it more.
Patches very much welcome, and we can change the situation in 2.2 if
there is a better state of affairs.
Cheers,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-16 18:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 0:43 Confusing Error Message Noah Lavine
2012-03-14 1:27 ` Ian Price
2013-01-16 18:10 ` Andy Wingo
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).