* bug#17418: #:select gives access to private variables
@ 2014-05-06 8:48 Ludovic Courtès
2014-06-02 1:06 ` Mark H Weaver
0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2014-05-06 8:48 UTC (permalink / raw)
To: 17418
Consider this module:
--8<---------------cut here---------------start------------->8---
(define-module (t))
(define private #t)
--8<---------------cut here---------------end--------------->8---
And now:
--8<---------------cut here---------------start------------->8---
[ludo@pluto:~/src/guix]$ guile -L .
GNU Guile 2.0.11.20-4338f
Copyright (C) 1995-2014 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)> (use-modules (t))
;;; note: source file ./t.scm
;;; newer than compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling ./t.scm
;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
scheme@(guile-user)> private
;;; <unknown-location>: warning: possibly unbound variable `private'
ERROR: In procedure #<procedure 1e532a0 ()>:
ERROR: In procedure module-lookup: Unbound variable: private
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
--8<---------------cut here---------------end--------------->8---
This is as expected.
But adding #:select (private) gives access to ‘private’:
--8<---------------cut here---------------end--------------->8---
[ludo@pluto:~/src/guix]$ guile -L .
GNU Guile 2.0.11.20-4338f
Copyright (C) 1995-2014 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)> (use-modules ((t) #:select (private)))
scheme@(guile-user)> private
$1 = #t
--8<---------------cut here---------------end--------------->8---
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2014-05-06 8:48 bug#17418: #:select gives access to private variables Ludovic Courtès
@ 2014-06-02 1:06 ` Mark H Weaver
2014-06-02 8:08 ` Ludovic Courtès
0 siblings, 1 reply; 9+ messages in thread
From: Mark H Weaver @ 2014-06-02 1:06 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 17418
ludo@gnu.org (Ludovic Courtès) writes:
> Consider this module:
>
> (define-module (t))
>
> (define private #t)
>
> And now:
>
> [ludo@pluto:~/src/guix]$ guile -L .
> GNU Guile 2.0.11.20-4338f
> Copyright (C) 1995-2014 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)> (use-modules (t))
> ;;; note: source file ./t.scm
> ;;; newer than compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
> ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
> ;;; or pass the --no-auto-compile argument to disable.
> ;;; compiling ./t.scm
> ;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
> scheme@(guile-user)> private
> ;;; <unknown-location>: warning: possibly unbound variable `private'
> ERROR: In procedure #<procedure 1e532a0 ()>:
> ERROR: In procedure module-lookup: Unbound variable: private
>
> Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
> scheme@(guile-user) [1]>
>
> This is as expected.
> But adding #:select (private) gives access to ‘private’:
>
> [ludo@pluto:~/src/guix]$ guile -L .
> GNU Guile 2.0.11.20-4338f
> Copyright (C) 1995-2014 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)> (use-modules ((t) #:select (private)))
> scheme@(guile-user)> private
> $1 = #t
I agree that this is arguably a bug, but there exists code that depends
on this behavior. One example is system/repl/coop-server.scm, which
needs access to some private bindings from system/repl/server.scm and
system/repl/repl.scm. I confess that I even suggested it, because the
alternatives were unpleasant.
Perhaps we should consider making #:select issue a warning when it
imports private bindings, and also adding a mechanism to import private
bindings without a warning.
What do you think?
Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2014-06-02 1:06 ` Mark H Weaver
@ 2014-06-02 8:08 ` Ludovic Courtès
2014-06-03 23:08 ` Mark H Weaver
0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2014-06-02 8:08 UTC (permalink / raw)
To: Mark H Weaver; +Cc: 17418
Hi, Mark!
Mark H Weaver <mhw@netris.org> skribis:
> Perhaps we should consider making #:select issue a warning when it
> imports private bindings,
Yes, sounds like a good idea.
> and also adding a mechanism to import private bindings without a
> warning.
I’m unsure about this. Normally we don’t want to allow that, because
that defeats the purpose of modules. OTOH, in practice we occasionally
need this ability; I typically use @@ for that, but it’s not as nice as
a real import.
Any idea what other schemes do?
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2014-06-02 8:08 ` Ludovic Courtès
@ 2014-06-03 23:08 ` Mark H Weaver
2014-06-03 23:11 ` Mark H Weaver
0 siblings, 1 reply; 9+ messages in thread
From: Mark H Weaver @ 2014-06-03 23:08 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 17418
ludo@gnu.org (Ludovic Courtès) writes:
> Mark H Weaver <mhw@netris.org> skribis:
>
>> Perhaps we should consider making #:select issue a warning when it
>> imports private bindings,
>
> Yes, sounds like a good idea.
Sounds good. Specifically, I guess we should deprecate this way of
using #:select.
If you do this, can you adjust system/repl/coop-server.scm to avoid it?
It imports the following private bindings:
start-repl* run-server* add-open-socket! close-socket!
>> and also adding a mechanism to import private bindings without a
>> warning.
>
> I’m unsure about this. Normally we don’t want to allow that, because
> that defeats the purpose of modules.
Fair enough. Having mulled it over, I tend to agree that we should not
try to make this more convenient.
> OTOH, in practice we occasionally need this ability; I typically use
> @@ for that, but it’s not as nice as a real import.
I think asking people to use @@ is reasonable here.
Thanks,
Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2014-06-03 23:08 ` Mark H Weaver
@ 2014-06-03 23:11 ` Mark H Weaver
2016-06-21 14:03 ` Andy Wingo
0 siblings, 1 reply; 9+ messages in thread
From: Mark H Weaver @ 2014-06-03 23:11 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 17418
Mark H Weaver <mhw@netris.org> writes:
> Sounds good. Specifically, I guess we should deprecate this way of
> using #:select.
>
> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
> It imports the following private bindings:
>
> start-repl* run-server* add-open-socket! close-socket!
Also: prompting-meta-read
Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2014-06-03 23:11 ` Mark H Weaver
@ 2016-06-21 14:03 ` Andy Wingo
2016-06-21 14:52 ` Ludovic Courtès
0 siblings, 1 reply; 9+ messages in thread
From: Andy Wingo @ 2016-06-21 14:03 UTC (permalink / raw)
To: Mark H Weaver; +Cc: Ludovic Courtès, 17418-done
On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw@netris.org> writes:
> Mark H Weaver <mhw@netris.org> writes:
>> Sounds good. Specifically, I guess we should deprecate this way of
>> using #:select.
>>
>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>> It imports the following private bindings:
>>
>> start-repl* run-server* add-open-socket! close-socket!
>
> Also: prompting-meta-read
Fixed in master.
Andy
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2016-06-21 14:03 ` Andy Wingo
@ 2016-06-21 14:52 ` Ludovic Courtès
2016-06-21 15:17 ` Andy Wingo
0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2016-06-21 14:52 UTC (permalink / raw)
To: Andy Wingo; +Cc: 17418-done
Andy Wingo <wingo@pobox.com> skribis:
> On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw@netris.org> writes:
>
>> Mark H Weaver <mhw@netris.org> writes:
>>> Sounds good. Specifically, I guess we should deprecate this way of
>>> using #:select.
>>>
>>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>>> It imports the following private bindings:
>>>
>>> start-repl* run-server* add-open-socket! close-socket!
>>
>> Also: prompting-meta-read
>
> Fixed in master.
I would not close the bug if it remains in 2.0.x. Thoughts?
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2016-06-21 14:52 ` Ludovic Courtès
@ 2016-06-21 15:17 ` Andy Wingo
2016-06-21 16:06 ` Ludovic Courtès
0 siblings, 1 reply; 9+ messages in thread
From: Andy Wingo @ 2016-06-21 15:17 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 17418-done
On Tue 21 Jun 2016 16:52, ludo@gnu.org (Ludovic Courtès) writes:
> Andy Wingo <wingo@pobox.com> skribis:
>
>> On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw@netris.org> writes:
>>
>>> Mark H Weaver <mhw@netris.org> writes:
>>>> Sounds good. Specifically, I guess we should deprecate this way of
>>>> using #:select.
>>>>
>>>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>>>> It imports the following private bindings:
>>>>
>>>> start-repl* run-server* add-open-socket! close-socket!
>>>
>>> Also: prompting-meta-read
>>
>> Fixed in master.
>
> I would not close the bug if it remains in 2.0.x. Thoughts?
I think we can't break 2.0 in this regard; it's technically
incompatible. We could print a better deprecation warning but in this
case I think I did the right thing. WDYT?
A
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#17418: #:select gives access to private variables
2016-06-21 15:17 ` Andy Wingo
@ 2016-06-21 16:06 ` Ludovic Courtès
0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2016-06-21 16:06 UTC (permalink / raw)
To: Andy Wingo; +Cc: 17418-done
Andy Wingo <wingo@pobox.com> skribis:
> On Tue 21 Jun 2016 16:52, ludo@gnu.org (Ludovic Courtès) writes:
>
>> Andy Wingo <wingo@pobox.com> skribis:
>>
>>> On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw@netris.org> writes:
>>>
>>>> Mark H Weaver <mhw@netris.org> writes:
>>>>> Sounds good. Specifically, I guess we should deprecate this way of
>>>>> using #:select.
>>>>>
>>>>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>>>>> It imports the following private bindings:
>>>>>
>>>>> start-repl* run-server* add-open-socket! close-socket!
>>>>
>>>> Also: prompting-meta-read
>>>
>>> Fixed in master.
>>
>> I would not close the bug if it remains in 2.0.x. Thoughts?
>
> I think we can't break 2.0 in this regard; it's technically
> incompatible. We could print a better deprecation warning but in this
> case I think I did the right thing. WDYT?
Yeah, you’re probably right; it would suddenly lead to unbound
variables, whether or not people realized they were relying on
“unspecified” behavior.
I withdraw my remark!
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-06-21 16:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-06 8:48 bug#17418: #:select gives access to private variables Ludovic Courtès
2014-06-02 1:06 ` Mark H Weaver
2014-06-02 8:08 ` Ludovic Courtès
2014-06-03 23:08 ` Mark H Weaver
2014-06-03 23:11 ` Mark H Weaver
2016-06-21 14:03 ` Andy Wingo
2016-06-21 14:52 ` Ludovic Courtès
2016-06-21 15:17 ` Andy Wingo
2016-06-21 16:06 ` Ludovic Courtès
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).