public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* synchronized in r7rs library
@ 2014-12-28 21:49 Seth Alves
  2014-12-28 22:18 ` Per Bothner
  0 siblings, 1 reply; 4+ messages in thread
From: Seth Alves @ 2014-12-28 21:49 UTC (permalink / raw)
  To: kawa mailing list

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

Calling (synchronized ...) from inside an r7rs library fails.

     -seth

$ ./kawa-r7rs-sync.scm
./kawa-r7rs-sync.scm:12:7: warning - no declaration seen for synchronized
Argument  '#<macro synchronized>' to 'apply-to-args' has wrong type 
(kawa.lang.Macro) (expected: procedure)
     at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:165)
     at gnu.mapping.ProcedureN.apply3(ProcedureN.java:48)
     at blerg.foo(kawa-r7rs-sync.scm:12)
     ...





[-- Attachment #2: kawa-r7rs-sync.scm --]
[-- Type: text/x-scheme, Size: 284 bytes --]

#! /bin/sh
#| -*- scheme -*-
exec /usr/local/bin/kawa $0 "$@"
|#

(define-library (blerg)
  (export foo)
  (import (scheme base))
  (begin
    (define lock-var #t)
    (define (foo)
      (synchronized lock-var
                    #t))))

(import (scheme base)
        (blerg))
(foo)

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

* Re: synchronized in r7rs library
  2014-12-28 21:49 synchronized in r7rs library Seth Alves
@ 2014-12-28 22:18 ` Per Bothner
  2014-12-29  0:31   ` Seth Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Per Bothner @ 2014-12-28 22:18 UTC (permalink / raw)
  To: kawa



On 12/28/2014 01:49 PM, Seth Alves wrote:
> Calling (synchronized ...) from inside an r7rs library fails.
>
>      -seth
>
> $ ./kawa-r7rs-sync.scm
> ./kawa-r7rs-sync.scm:12:7: warning - no declaration seen for synchronized
> Argument  '#<macro synchronized>' to 'apply-to-args' has wrong type (kawa.lang.Macro) (expected: procedure)

Now we're getting into Kawa-specific extensions.  These should not be
visible if you do (only): (import (scheme base))

Perhaps we should define a (kawa all) library?  A (kawa jvm) library?
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: synchronized in r7rs library
  2014-12-28 22:18 ` Per Bothner
@ 2014-12-29  0:31   ` Seth Alves
  2014-12-29  1:56     ` Per Bothner
  0 siblings, 1 reply; 4+ messages in thread
From: Seth Alves @ 2014-12-29  0:31 UTC (permalink / raw)
  To: kawa


Well... I notice that it's callable from the top-level, just not from 
within an r7rs library.  Is there currently some incantation that would 
import it (as well as future, force, runnable)?

     -seth

On 12/28/2014 02:18 PM, Per Bothner wrote:
>
>
> On 12/28/2014 01:49 PM, Seth Alves wrote:
>> Calling (synchronized ...) from inside an r7rs library fails.
>>
>>      -seth
>>
>> $ ./kawa-r7rs-sync.scm
>> ./kawa-r7rs-sync.scm:12:7: warning - no declaration seen for 
>> synchronized
>> Argument  '#<macro synchronized>' to 'apply-to-args' has wrong type 
>> (kawa.lang.Macro) (expected: procedure)
>
> Now we're getting into Kawa-specific extensions.  These should not be
> visible if you do (only): (import (scheme base))
>
> Perhaps we should define a (kawa all) library?  A (kawa jvm) library?

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

* Re: synchronized in r7rs library
  2014-12-29  0:31   ` Seth Alves
@ 2014-12-29  1:56     ` Per Bothner
  0 siblings, 0 replies; 4+ messages in thread
From: Per Bothner @ 2014-12-29  1:56 UTC (permalink / raw)
  To: kawa



On 12/28/2014 04:31 PM, Seth Alves wrote:
>
> Well... I notice that it's callable from the top-level, just not from
> within an r7rs library.

This is what r7rs requires: In a define-library the only visible
bindings are those explicitly defined or imported.  OTOH at the top-level
"For convenience and ease of use, the global Scheme environment in a
REPL must not be empty, but must start out with at least the bindings
provided by the base library."

One of the things I had to explicitly work on for the R7RS functionality was
making sure the define-library "environment" starts out empty.

> Is there currently some incantation that
> would import it

The following should work:

(import (only (kawa lib syntax) synchronized))

However, that will not work if synchronized is moved
from the kawa.lib.syntax class.  That sort of thing occasionally
happens, as I consider the specific implementation class an
implementation detail.

> (as well as future, force, runnable)?

That is why as need to define some library such as (kawa all) or
(kawa jvm). so you could (import (kawa jvm)) - as I mentioned in my
previous message.

-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

end of thread, other threads:[~2014-12-29  1:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-28 21:49 synchronized in r7rs library Seth Alves
2014-12-28 22:18 ` Per Bothner
2014-12-29  0:31   ` Seth Alves
2014-12-29  1:56     ` Per Bothner

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