unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* confused about make-module and eval
@ 2020-03-24  0:32 Matt Wette
  2020-03-24  0:35 ` Massimiliano Gubinelli
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Wette @ 2020-03-24  0:32 UTC (permalink / raw)
  To: Guile User

I expect this to work, but it does not.  Any anyone elaborate?
What is the minimum module that can make this work?  (make-fresh-use-module)?

scheme@(guile-user)> (eval '(lambda (a b c) 1) (make-module))
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Unbound variable: lambda

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(#{ g188}#) [1]>




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

* Re: confused about make-module and eval
  2020-03-24  0:32 confused about make-module and eval Matt Wette
@ 2020-03-24  0:35 ` Massimiliano Gubinelli
  2020-03-24  9:16   ` tomas
  0 siblings, 1 reply; 5+ messages in thread
From: Massimiliano Gubinelli @ 2020-03-24  0:35 UTC (permalink / raw)
  To: Matt Wette; +Cc: Guile User

I think a fresh module do not have any binding. So 'lambda is not defined. You would have to create bindings inside the module, maybe you could just import the-scm-module .

In particular this can be a way to allow only certain functionality to be available to the program you eval.

Best
max


> On 24. Mar 2020, at 01:32, Matt Wette <matt.wette@gmail.com> wrote:
> 
> I expect this to work, but it does not.  Any anyone elaborate?
> What is the minimum module that can make this work?  (make-fresh-use-module)?
> 
> scheme@(guile-user)> (eval '(lambda (a b c) 1) (make-module))
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> Unbound variable: lambda
> 
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> scheme@(#{ g188}#) [1]>
> 
> 




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

* Re: confused about make-module and eval
  2020-03-24  0:35 ` Massimiliano Gubinelli
@ 2020-03-24  9:16   ` tomas
  2020-03-24  9:27     ` Massimiliano Gubinelli
  0 siblings, 1 reply; 5+ messages in thread
From: tomas @ 2020-03-24  9:16 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

On 24. Mar 2020, at 01:32, Matt Wette <matt.wette@gmail.com> wrote:

> I expect this to work, but it does not.  Any anyone elaborate?
> What is the minimum module that can make this work?  (make-fresh-use-module)?

On Tue, Mar 24, 2020 at 01:35:51AM +0100, Massimiliano Gubinelli wrote:
> I think a fresh module do not have any binding. So 'lambda is not defined. You would have to create bindings inside the module, maybe you could just import the-scm-module .

Yes, I think that is it. The documentation is fairly sparse;
There is something in "6.20.12 Environments" [1], and via
R5RS environments (ice-9 r5rs) you have access to some kinda
standard environments (scheme-report-environment, etc.)

As you already noticed (in the context of NYACC) , this topic
is is also somewhat  coufusing and fascinating for me :-)

Cheers
--tomás

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: confused about make-module and eval
  2020-03-24  9:16   ` tomas
@ 2020-03-24  9:27     ` Massimiliano Gubinelli
  2020-03-24  9:35       ` tomas
  0 siblings, 1 reply; 5+ messages in thread
From: Massimiliano Gubinelli @ 2020-03-24  9:27 UTC (permalink / raw)
  To: tomas; +Cc: guile-user

you can look into ice-9/boot-9.scm to see how modules are populated. I'm not sure now how to do it right.

For example you could use 

export-all!
use-module!

etc...

Best
max

> On 24. Mar 2020, at 10:16, <tomas@tuxteam.de> <tomas@tuxteam.de> wrote:
> 
> On 24. Mar 2020, at 01:32, Matt Wette <matt.wette@gmail.com> wrote:
> 
>> I expect this to work, but it does not.  Any anyone elaborate?
>> What is the minimum module that can make this work?  (make-fresh-use-module)?
> 
> On Tue, Mar 24, 2020 at 01:35:51AM +0100, Massimiliano Gubinelli wrote:
>> I think a fresh module do not have any binding. So 'lambda is not defined. You would have to create bindings inside the module, maybe you could just import the-scm-module .
> 
> Yes, I think that is it. The documentation is fairly sparse;
> There is something in "6.20.12 Environments" [1], and via
> R5RS environments (ice-9 r5rs) you have access to some kinda
> standard environments (scheme-report-environment, etc.)
> 
> As you already noticed (in the context of NYACC) , this topic
> is is also somewhat  coufusing and fascinating for me :-)
> 
> Cheers
> --tomás




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

* Re: confused about make-module and eval
  2020-03-24  9:27     ` Massimiliano Gubinelli
@ 2020-03-24  9:35       ` tomas
  0 siblings, 0 replies; 5+ messages in thread
From: tomas @ 2020-03-24  9:35 UTC (permalink / raw)
  To: Massimiliano Gubinelli; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 211 bytes --]

On Tue, Mar 24, 2020 at 10:27:35AM +0100, Massimiliano Gubinelli wrote:
> you can look into ice-9/boot-9.scm to see how modules are populated. I'm not sure now how to do it right.

Thanks, will do.

Cheers
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2020-03-24  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24  0:32 confused about make-module and eval Matt Wette
2020-03-24  0:35 ` Massimiliano Gubinelli
2020-03-24  9:16   ` tomas
2020-03-24  9:27     ` Massimiliano Gubinelli
2020-03-24  9:35       ` tomas

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