* Why does compile discard multiple values?
@ 2022-08-10 13:01 Jean Abou Samra
2022-08-10 13:11 ` Jean Abou Samra
2022-08-10 18:08 ` Maxime Devos
0 siblings, 2 replies; 5+ messages in thread
From: Jean Abou Samra @ 2022-08-10 13:01 UTC (permalink / raw)
To: Guile User
Hi,
See:
$ guile3.0
GNU Guile 3.0.7
Copyright (C) 1995-2021 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (eval '(values 1 2) (current-module))
$1 = 1
$2 = 2
scheme@(guile-user)> (use-modules (system base compile))
scheme@(guile-user)> (compile '(values 1 2) #:env (current-module))
$3 = 1
Is it expected that compile doesn't cope with a return of
multiple values?
I can work around that using
((compile `(lambda () ,my-form)
#:env (current-module)))
but I would have expected it to work out of the box. Should
I raise it on the bug tracker?
Thanks,
Jean
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why does compile discard multiple values?
2022-08-10 13:01 Why does compile discard multiple values? Jean Abou Samra
@ 2022-08-10 13:11 ` Jean Abou Samra
2022-08-10 13:20 ` Jean Abou Samra
2022-08-10 18:08 ` Maxime Devos
1 sibling, 1 reply; 5+ messages in thread
From: Jean Abou Samra @ 2022-08-10 13:11 UTC (permalink / raw)
To: Guile User
Le 10/08/2022 à 15:01, Jean Abou Samra a écrit :
> I can work around that using
>
> ((compile `(lambda () ,my-form)
> #:env (current-module)))
Ugh, no, I can't. The form might be a define.
Does anybody know of a workaround?
Thanks,
Jean
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why does compile discard multiple values?
2022-08-10 13:11 ` Jean Abou Samra
@ 2022-08-10 13:20 ` Jean Abou Samra
0 siblings, 0 replies; 5+ messages in thread
From: Jean Abou Samra @ 2022-08-10 13:20 UTC (permalink / raw)
To: Guile User
Le 10/08/2022 à 15:11, Jean Abou Samra a écrit :
>
>
> Le 10/08/2022 à 15:01, Jean Abou Samra a écrit :
>> I can work around that using
>>
>> ((compile `(lambda () ,my-form)
>> #:env (current-module)))
>
>
> Ugh, no, I can't. The form might be a define.
>
> Does anybody know of a workaround?
OK, digging into the implementation, I found
scheme@(guile-user)> (use-modules (system vm loader))
scheme@(guile-user)> ((load-thunk-from-memory (compile '(values 1 2)
#:to 'bytecode #:env (current-module))))
$1 = 1
$2 = 2
If someone has a better workaround, I'm still interested.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why does compile discard multiple values?
2022-08-10 13:01 Why does compile discard multiple values? Jean Abou Samra
2022-08-10 13:11 ` Jean Abou Samra
@ 2022-08-10 18:08 ` Maxime Devos
2022-08-10 18:11 ` Jean Abou Samra
1 sibling, 1 reply; 5+ messages in thread
From: Maxime Devos @ 2022-08-10 18:08 UTC (permalink / raw)
To: Jean Abou Samra, Guile User
[-- Attachment #1.1.1: Type: text/plain, Size: 818 bytes --]
On 10-08-2022 15:01, Jean Abou Samra wrote:
> Hi,
>
> See:
>
> $ guile3.0
> GNU Guile 3.0.7
> Copyright (C) 1995-2021 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (eval '(values 1 2) (current-module))
> $1 = 1
> $2 = 2
> scheme@(guile-user)> (use-modules (system base compile))
> scheme@(guile-user)> (compile '(values 1 2) #:env (current-module))
> $3 = 1
>
>
> Is it expected that compile doesn't cope with a return of
> multiple values? [...]
Sounds like a bug to me (it's not a documented limitation). I would
report it.
Greetings,
Maxime
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why does compile discard multiple values?
2022-08-10 18:08 ` Maxime Devos
@ 2022-08-10 18:11 ` Jean Abou Samra
0 siblings, 0 replies; 5+ messages in thread
From: Jean Abou Samra @ 2022-08-10 18:11 UTC (permalink / raw)
To: Maxime Devos, Guile User
Le 10/08/2022 à 20:08, Maxime Devos a écrit :
>
> On 10-08-2022 15:01, Jean Abou Samra wrote:
>> Hi,
>>
>> See:
>>
>> $ guile3.0
>> GNU Guile 3.0.7
>> Copyright (C) 1995-2021 Free Software Foundation, Inc.
>>
>> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
>> This program is free software, and you are welcome to redistribute it
>> under certain conditions; type `,show c' for details.
>>
>> Enter `,help' for help.
>> scheme@(guile-user)> (eval '(values 1 2) (current-module))
>> $1 = 1
>> $2 = 2
>> scheme@(guile-user)> (use-modules (system base compile))
>> scheme@(guile-user)> (compile '(values 1 2) #:env (current-module))
>> $3 = 1
>>
>>
>> Is it expected that compile doesn't cope with a return of
>> multiple values? [...]
>
> Sounds like a bug to me (it's not a documented limitation). I would
> report it.
Thanks, done:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57123
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-10 18:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 13:01 Why does compile discard multiple values? Jean Abou Samra
2022-08-10 13:11 ` Jean Abou Samra
2022-08-10 13:20 ` Jean Abou Samra
2022-08-10 18:08 ` Maxime Devos
2022-08-10 18:11 ` Jean Abou Samra
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).