unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* 1.8.2 srfi-19 warns about current-time
@ 2007-10-05  4:25 Gregory Marton
  2007-10-07 16:18 ` Jon Wilson
  0 siblings, 1 reply; 10+ messages in thread
From: Gregory Marton @ 2007-10-05  4:25 UTC (permalink / raw)
  To: bug-guile

In guile-1.8.2 (use-modules (srfi srfi-19)) warns:
    WARNING: (guile-user): imported module (srfi srfi-19) overrides core
    binding `current-time'

Apparently one can control this using the #:replace keyword:
http://www.gnu.org/software/guile/manual/html_node/Creating-Guile-Modules.html#Creating-Guile-Modules

Is there some reason srfi-19 doesn't use this?

Thanks,
Grem


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-05  4:25 1.8.2 srfi-19 warns about current-time Gregory Marton
@ 2007-10-07 16:18 ` Jon Wilson
  2007-10-07 17:22   ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Jon Wilson @ 2007-10-07 16:18 UTC (permalink / raw)
  To: Gregory Marton; +Cc: bug-guile

Hi Gregory,
 From the very page you linked:

SRFI-19, on the other hand, exports its own version of |current-time| 
(see SRFI-19 Time 
<http://www.gnu.org/software/guile/manual/html_node/SRFI_002d19-Time.html#SRFI_002d19-Time>) 
which is not compatible with the core |current-time| function (see Time 
<http://www.gnu.org/software/guile/manual/html_node/Time.html#Time>). 
Therefore, SRFI-19 does not use |#:replace|.

Regards,
Jon


Gregory Marton wrote:
> In guile-1.8.2 (use-modules (srfi srfi-19)) warns:
>    WARNING: (guile-user): imported module (srfi srfi-19) overrides core
>    binding `current-time'
>
> Apparently one can control this using the #:replace keyword:
> http://www.gnu.org/software/guile/manual/html_node/Creating-Guile-Modules.html#Creating-Guile-Modules 
>
>
> Is there some reason srfi-19 doesn't use this?
>
> Thanks,
> Grem
>
>
> _______________________________________________
> Bug-guile mailing list
> Bug-guile@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-guile



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-07 16:18 ` Jon Wilson
@ 2007-10-07 17:22   ` Ludovic Courtès
  2007-10-08 15:35     ` Gregory Marton
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2007-10-07 17:22 UTC (permalink / raw)
  To: bug-guile

Hi,

Jon Wilson <jsw@wilsonjc.us> writes:

> SRFI-19, on the other hand, exports its own version of |current-time|
> (see SRFI-19 Time
> <http://www.gnu.org/software/guile/manual/html_node/SRFI_002d19-Time.html#SRFI_002d19-Time>)
> which is not compatible with the core |current-time| function (see
> Time
> <http://www.gnu.org/software/guile/manual/html_node/Time.html#Time>). Therefore,
> SRFI-19 does not use |#:replace|.

FWIW, I think it's pointless to *not* use `:replace' in situations like
this where one can reasonably assume the user knows that bindings are
going to overridden:

  http://thread.gmane.org/gmane.lisp.guile.devel/5330
  http://thread.gmane.org/gmane.lisp.guile.devel/5360

There is no consensus about it, though.  :-)

Thanks,
Ludovic.



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-07 17:22   ` Ludovic Courtès
@ 2007-10-08 15:35     ` Gregory Marton
  2007-10-08 18:00       ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Gregory Marton @ 2007-10-08 15:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guile

Thanks Jon, Ludovic,

I indeed hadn't noticed that it was intentional, but I'm in agreement with 
Ludovic.  I'm concerned that my customer shouldn't be confused and worried 
by a warning, and I see no way to override the warning myself.

This is a bit of overkill, but I thought it might work:
  (with-error-to-string (lambda () (use-modules (srfi srfi-19))))
But no: use-modules can only be used at top level.

Even if I could figure out a way to do that, (I dunno, figuring out what 
global variable (current-error-port) uses and manually set!ing it to 
something else temporarily?) I'd be worried about missing actually 
important warnings.

Do I have any option besides forking srfi-19.scm and using :replace?

Thanks,
Grem

> Hi,
>
> Jon Wilson <jsw@wilsonjc.us> writes:
>
>> SRFI-19, on the other hand, exports its own version of |current-time|
>> (see SRFI-19 Time
>> <http://www.gnu.org/software/guile/manual/html_node/SRFI_002d19-Time.html#SRFI_002d19-Time>)
>> which is not compatible with the core |current-time| function (see
>> Time
>> <http://www.gnu.org/software/guile/manual/html_node/Time.html#Time>). Therefore,
>> SRFI-19 does not use |#:replace|.
>
> FWIW, I think it's pointless to *not* use `:replace' in situations like
> this where one can reasonably assume the user knows that bindings are
> going to overridden:
>
>  http://thread.gmane.org/gmane.lisp.guile.devel/5330
>  http://thread.gmane.org/gmane.lisp.guile.devel/5360
>
> There is no consensus about it, though.  :-)
>
> Thanks,
> Ludovic.
>
>
>
> _______________________________________________
> Bug-guile mailing list
> Bug-guile@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-guile
>

-- 
------ __@   Gregory A. Marton                http://csail.mit.edu/~gremio/
--- _`\<,_                                                                .
-- (*)/ (*)           Now accepting spam for just $1000 per word.
~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-08 15:35     ` Gregory Marton
@ 2007-10-08 18:00       ` Ludovic Courtès
  2007-10-08 20:51         ` Gregory Marton
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2007-10-08 18:00 UTC (permalink / raw)
  To: bug-guile

Hi,

Gregory Marton <gremio@csail.mit.edu> writes:

> I indeed hadn't noticed that it was intentional, but I'm in agreement
> with Ludovic.  I'm concerned that my customer shouldn't be confused
> and worried by a warning, and I see no way to override the warning
> myself.

You can insert the following line at the beginning of your program:

  (default-duplicate-binding-handler 'last)

This will instruct Guile to always use the `last' duplicate binding
handler, thereby not issuing any warning (make sure you understand what
it does, looking at the manual).

Another solution would be (again, execute it ASAP):

  (module-replace! (resolve-module '(srfi srfi-19))
                   '(current-time))

Use at your own risk.  :-)

Thanks,
Ludovic.



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-08 18:00       ` Ludovic Courtès
@ 2007-10-08 20:51         ` Gregory Marton
  2007-10-08 21:34           ` Jon Wilson
  2007-10-09 21:22           ` Ludovic Courtès
  0 siblings, 2 replies; 10+ messages in thread
From: Gregory Marton @ 2007-10-08 20:51 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guile

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2156 bytes --]

Thank you!

On Mon, 8 Oct 2007, Ludovic Courtès wrote:

> Hi,
>
> Gregory Marton <gremio@csail.mit.edu> writes:
>
>> I indeed hadn't noticed that it was intentional, but I'm in agreement
>> with Ludovic.  I'm concerned that my customer shouldn't be confused
>> and worried by a warning, and I see no way to override the warning
>> myself.
>
> You can insert the following line at the beginning of your program:
>
>  (default-duplicate-binding-handler 'last)

This affects all bindings, not just the ones I no longer want to be warned 
about.

> This will instruct Guile to always use the `last' duplicate binding
> handler, thereby not issuing any warning (make sure you understand what
> it does, looking at the manual).
>
> Another solution would be (again, execute it ASAP):
>
>  (module-replace! (resolve-module '(srfi srfi-19))
>                   '(current-time))

resolve-module finds the module with the given name and returns it.
http://gnu.rtin.bz/software/guile/docs/docs-1.8/guile-ref/Module-System-Reflection.html

module-replace! forces the list of symbols in its second argument to be put 
into the :replace list?
   (could not find documentation)

> Use at your own risk.  :-)

What's the risk, besides unwittingly using srfi-19's current-time when I 
wanted to use the core current-time?

This sounds like the solution I want to adopt.



As a question outside the scope of this conversation, why does srfi-19 not 
use time-monotonic to mean what the core current-time means, and make that 
default instead of utc?  Then it could :replace without fear, and we 
wouldn't be in this wrinkle.  The "perhaps this will change in the future" 
gives me hope. 
http://www.gnu.org/software/guile/manual/html_node/SRFI_002d19-Time.html#SRFI_002d19-Time

Thanks very much for your help!
Grem

-- 
------ __@   Gregory A. Marton                http://csail.mit.edu/~gremio/
--- _`\<,_                                                                .
-- (*)/ (*)            Truth is not determined by majority vote.
~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~

[-- Attachment #2: Type: text/plain, Size: 137 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile

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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-08 20:51         ` Gregory Marton
@ 2007-10-08 21:34           ` Jon Wilson
  2007-10-09 21:22           ` Ludovic Courtès
  1 sibling, 0 replies; 10+ messages in thread
From: Jon Wilson @ 2007-10-08 21:34 UTC (permalink / raw)
  To: bug-guile

Hi Greg,
One more option is to rename all of the symbols coming in from srfi-19. 
  I've used this myself.

(use-modules ((srfi srfi-19) :renamer (symbol-prefix-proc 'tm:)))

This prefixes every symbol exported by srfi-19 with tm:, so current-time 
becomes tm:current-time etc.

Regards,
Jon


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-08 20:51         ` Gregory Marton
  2007-10-08 21:34           ` Jon Wilson
@ 2007-10-09 21:22           ` Ludovic Courtès
  2007-10-09 22:38             ` Gregory Marton
  1 sibling, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2007-10-09 21:22 UTC (permalink / raw)
  To: bug-guile

Hi,

Gregory Marton <gremio@csail.mit.edu> writes:

> On Mon, 8 Oct 2007, Ludovic Courtès wrote:

>> You can insert the following line at the beginning of your program:
>>
>>  (default-duplicate-binding-handler 'last)
>
> This affects all bindings, not just the ones I no longer want to be
> warned about.

Yes.

> resolve-module finds the module with the given name and returns it.
> http://gnu.rtin.bz/software/guile/docs/docs-1.8/guile-ref/Module-System-Reflection.html
>
> module-replace! forces the list of symbols in its second argument to
> be put into the :replace list?
>   (could not find documentation)

Correct.  It's not documented (yet).

> What's the risk, besides unwittingly using srfi-19's current-time when
> I wanted to use the core current-time?

The risk is that you're using undocumented features that might change or
vanish someday.

Note that using `:renamer' as Jon suggested is more "future-proof",
albeit slightly less convenient.

> As a question outside the scope of this conversation, why does srfi-19
> not use time-monotonic to mean what the core current-time means, and
> make that default instead of utc?

Because the argument to SRFI-19 `current-time' defaults to `time-utc',
and we can't change it.  :-)

Thanks,
Ludovic.



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-09 21:22           ` Ludovic Courtès
@ 2007-10-09 22:38             ` Gregory Marton
  2007-10-10 16:10               ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Gregory Marton @ 2007-10-09 22:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guile

>> module-replace! forces the list of symbols in its second argument to
>> be put into the :replace list?
>>   (could not find documentation)
>
> Correct.  It's not documented (yet).

Can I help?  I mean, presuming that the sentence above, or some extension, 
is reasonable documentation?  I get a sense that there is a reluctance to 
document things because that entails a commitment to supporting them in the 
future -- is that the issue here?

> Because the argument to SRFI-19 `current-time' defaults to `time-utc',
> and we can't change it.  :-)

Being new to the community, I don't have a sense of how this strange 
library system called srfi works.  It does not appear to have version 
control.  Would one propose a (string-append "srfi-" (next-id)) that's just 
like srfi-19 except that it has current-time defaulting to time-monotonic? 
If this is a ball of hair I can read about somewhere, or should take 
offline, I'm happy with that.  I'm just curious.

Thanks,
Grem

-- 
------ __@   Gregory A. Marton                http://csail.mit.edu/~gremio/
--- _`\<,_                                                                .
-- (*)/ (*)                Down with gravity!  Gravity sucks!
~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.2 srfi-19 warns about current-time
  2007-10-09 22:38             ` Gregory Marton
@ 2007-10-10 16:10               ` Ludovic Courtès
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2007-10-10 16:10 UTC (permalink / raw)
  To: bug-guile

Hi,

Gregory Marton <gremio@csail.mit.edu> writes:

> Can I help?  I mean, presuming that the sentence above, or some
> extension, is reasonable documentation?  I get a sense that there is a
> reluctance to document things because that entails a commitment to
> supporting them in the future -- is that the issue here?

Not really.  I was planning to document part of the `module-' procedure
but never did it.  In case you want to do it, those worth documenting
(IMO) are the following:

  module-define!
  module-defined?
  module-duplicates-handlers
  module-export!
  module-for-each
  module-map
  module-name
  module-public-interface
  module-re-export!
  module-ref
  module-remove!
  module-replace!
  module-reverse-lookup  ;; with xref to the "Variables" node
  module-set!
  module-variable        ;; with xref to the "Variables" node

This would go under the "Module System Reflection" node.  Feel free to
contribute!  :-)

> Being new to the community, I don't have a sense of how this strange
> library system called srfi works.

SRFIs are a community standardization process among Scheme
implementors and users:

  http://srfi.schemers.org/

Anyone can propose an SRFI, but you wouldn't amend an SRFI just to make
such or such implementation happier.  The idea is to provide APIs
portable among implementations.  In practice, they are often implemented
as a layer above the implementation's own API for the same purpose.

Thanks,
Ludovic.



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

end of thread, other threads:[~2007-10-10 16:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05  4:25 1.8.2 srfi-19 warns about current-time Gregory Marton
2007-10-07 16:18 ` Jon Wilson
2007-10-07 17:22   ` Ludovic Courtès
2007-10-08 15:35     ` Gregory Marton
2007-10-08 18:00       ` Ludovic Courtès
2007-10-08 20:51         ` Gregory Marton
2007-10-08 21:34           ` Jon Wilson
2007-10-09 21:22           ` Ludovic Courtès
2007-10-09 22:38             ` Gregory Marton
2007-10-10 16:10               ` 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).