Re: [Chicken-users] Some syntax help?
On Sat, May 02, 2015 at 07:13:55PM -0700, Dan Leslie wrote: First off, thank-you for the aid! You're welcome! Peter Bex pe...@more-magic.net writes: I'm sorry to say it, but this egg contains a lot of strange mistakes and weird things; for example, the setup-file tries to emit a module named funky, which does not exist. Also, the renaming procedure from explicit renaming macro transformers is referred to as inject, which is extremely misleading: that's the _opposite_ of what it does! Heh, the `funky` was a copy-paste mistake; oops. ;) It's also a bit of a problem that csc doesn't give an error when trying to emit an import file that doesn't exist. I've created a ticket so we don't forget: https://bugs.call-cc.org/ticket/1188 The opposite of inject would be extract; can you explain this a little more? I'll admit, I'm quite confused by Chicken's syntax extensions. The opposite of inject in macros is rename. Injection causes the specified identifier to be used as-is, unhygienically. Renaming causes the identifier to be renamed so it won't shadow (or be shadowed by) any locally available identifiers at the macro expansion site. There are a few tutorials about how this works, see http://wiki.call-cc.org/tutorials I liked the separation between compilation scope for the 'core' and the ecosystem of methods that build upon it. I agree, it's somewhat confusing at first glance, but it made catching the problems faster when I had yet to write any tests. ;) Yeah, it may just work. Thank-you again! This egg was my first real foray into playing with Chicken's lower level syntax extensions; and I must say it's been rather confusing, which seems to have been due to gross misunderstandings on my part. No problem. If you have further questions, just ask :) Cheers, Peter signature.asc Description: Digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Some syntax help?
The incorrect code that CSC allows other things to work on: This should have stated CSI. -Dan On Sat, May 2, 2015 at 8:01 AM, Dan Leslie d...@ironoxide.ca wrote: Hi Chickeners! Around two weeks ago I received a bug report that the monad egg wasn't working in CSC. This turned out to be the result of a syntax error, and though I've greatly simplified the syntax and narrowed the issue considerably, I find myself stuck in a corner while surrounded by wet paint. Working branch is here: https://github.com/dleslie/monad-egg/tree/compiler-import-bug The issue is thus: the egg does some heavy lifting of syntax transforms, and there exists a utility such that a user might bind new symbols while within the quoted syntax of a stack of transformers. It looks like this: (do state (/m! put 99) (x - (/m get)) (return x)) Which would expand to something similar to: (state-bind (state-put 99) (state-bind (state-get) (lambda (x) (state-unit x I think; it's early. ;) Anyhow, notice that the /m and /m! transforms occur within the do syntax; the do syntax transforms through do-using, %unroll-do-using, and finally to using; where they're defined dynamically within a quoted syntax block. Here's the wierdness: this works magnificently in CSI, but fails in CSC. Moreover, if I replace /m! with a broken variant then /m works great in both CSI and CSC! I know, it doesn't make much sense to me either. My best guess is that /m! failing somehow short-circuits a code path in the compiler and so allows /m to function as I expect. The correct code that CSC breaks on: https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L58-L61 And test output: https://gist.github.com/71cc934fbc9fc7fa2d86 The incorrect code that CSC allows other things to work on: https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L63-L66 And test output: https://gist.github.com/d0c276f7ed243d79166b Any thoughts would be appreciated. :D Thanks! -- -Dan Leslie ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Some syntax help?
Hi Chickeners! Around two weeks ago I received a bug report that the monad egg wasn't working in CSC. This turned out to be the result of a syntax error, and though I've greatly simplified the syntax and narrowed the issue considerably, I find myself stuck in a corner while surrounded by wet paint. Working branch is here: https://github.com/dleslie/monad-egg/tree/compiler-import-bug The issue is thus: the egg does some heavy lifting of syntax transforms, and there exists a utility such that a user might bind new symbols while within the quoted syntax of a stack of transformers. It looks like this: (do state (/m! put 99) (x - (/m get)) (return x)) Which would expand to something similar to: (state-bind (state-put 99) (state-bind (state-get) (lambda (x) (state-unit x I think; it's early. ;) Anyhow, notice that the /m and /m! transforms occur within the do syntax; the do syntax transforms through do-using, %unroll-do-using, and finally to using; where they're defined dynamically within a quoted syntax block. Here's the wierdness: this works magnificently in CSI, but fails in CSC. Moreover, if I replace /m! with a broken variant then /m works great in both CSI and CSC! I know, it doesn't make much sense to me either. My best guess is that /m! failing somehow short-circuits a code path in the compiler and so allows /m to function as I expect. The correct code that CSC breaks on: https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L58-L61 And test output: https://gist.github.com/71cc934fbc9fc7fa2d86 The incorrect code that CSC allows other things to work on: https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L63-L66 And test output: https://gist.github.com/d0c276f7ed243d79166b Any thoughts would be appreciated. :D Thanks! -- -Dan Leslie ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Some syntax help?
And thanks to your feedback the branch is now passing the available tests. Turns out that (syntax) was allowing the two-modules-in-one-file thing to work. Taking that out caused... Problems. ;) -- -Dan Leslie ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users