Re: Enhancement to the syntax system?

2012-07-04 Thread Marijn
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Stefan,

On 03-07-12 23:52, Stefan Israelsson Tampe wrote:
 You do not need gensyms if you try to mimic or implement my
 suggested #. . On the other hand when if you do this
 
 (define (f stx) #`(let ((x 1)) #,stx))
 
 and use this with
 
 #`(let ((x 2)) #,(f #'x))
 
 the resulting expanded code would produce 1 which is not what you
 want.

I tried it in Racket:


(define-for-syntax (f stx) #`(let ((x 1)) #,stx))

(define-syntax (m stx)
  (syntax-case stx ()
((_) #`(let ((x 2)) #,(f #'x))) ))

(m)


but I get error messages which I don't know what to do about. Do you
have running examples of code not producing the result you want?

Marijn
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/z9PsACgkQp/VmCx0OL2xMNACbBJKq9nZJKTzCJbdnq0iPgJoE
rSwAn2yJ1JTLMUn6v5ZR/PatxcGxgVrU
=HFFX
-END PGP SIGNATURE-



Re: Enhancement to the syntax system?

2012-07-04 Thread Stefan Israelsson Tampe
Funny,  for guile I get,
scheme@(guile-user) (define (f x) #`(let ((x 1)) #,x))
scheme@(guile-user) (define-syntax m (lambda (x) (syntax-case x () ((_)
#`(let ((x 2)) #,(f #'x))
scheme@(guile-user) (m)
$1 = 1

I ported the racket matcher to guile and worked in that environment, so
this illustrate the problem.
In racket the same idea will error out as you say (I did not find anything
wrong with your example).
I do prefer the racket behavior of bailing out because it can help
detecting the bug in stead of silently
behave against the intention for newbies. My original code where this issue
comes from is located in
compat/racket/match/match.scm in the syntax-parse repo at

https://gitorious.org/guile-syntax-parse/guile-syntax-parse

This is the racket matcher implemented using syntax-parse!

These bugs should have been corrected though in that code!

/Stefan

On Wed, Jul 4, 2012 at 9:47 AM, Marijn hk...@gentoo.org wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi Stefan,

 On 03-07-12 23:52, Stefan Israelsson Tampe wrote:
  You do not need gensyms if you try to mimic or implement my
  suggested #. . On the other hand when if you do this
 
  (define (f stx) #`(let ((x 1)) #,stx))
 
  and use this with
 
  #`(let ((x 2)) #,(f #'x))
 
  the resulting expanded code would produce 1 which is not what you
  want.

 I tried it in Racket:


 (define-for-syntax (f stx) #`(let ((x 1)) #,stx))

 (define-syntax (m stx)
   (syntax-case stx ()
 ((_) #`(let ((x 2)) #,(f #'x))) ))

 (m)


 but I get error messages which I don't know what to do about. Do you
 have running examples of code not producing the result you want?

 Marijn
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v2.0.19 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk/z9PsACgkQp/VmCx0OL2xMNACbBJKq9nZJKTzCJbdnq0iPgJoE
 rSwAn2yJ1JTLMUn6v5ZR/PatxcGxgVrU
 =HFFX
 -END PGP SIGNATURE-



Re: scm_to_pointer vs scm-pointer

2012-07-04 Thread Andy Wingo
On Tue 03 Jul 2012 23:47, l...@gnu.org (Ludovic Courtès) writes:

 This should be fixed.  Otherwise it's impossible to document in any
 sane fashion.

 Suggestion: change scm_to_pointer to SCM_POINTER_VALUE.  WDYT?

 I’m happy with this change.  Mark?

 (Back then, I was skeptical about the usefulness of the C pointer API.
 I have since used ‘SCM_POINTER_VALUE’ and ‘scm_from_pointer’ in
 Guile-GCC, which uses a mixed dynamic/static FFI, and for good reasons.)

On second thought, let's leave it in.  It is terribly confusing, but
alternatives are worse.

Andy
-- 
http://wingolog.org/