Comments (13)
Eli - Thanks for your time, I'll look into both of these issues.
I need this kind of input to improve the project...
from husk-scheme.
15 minutes ago, justinethier wrote:
Eli - Thanks for your time, I'll look into both of these issues.
I need this kind of input to improve the project...
Well, FWIW, I suspect that such things would require some major
revisions...
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
from husk-scheme.
That's fine, if the changes aren't feasible then at least there's a record here. Thanks again for your feedback!
from husk-scheme.
Version 3.1 (now in the master branch) fixes issues with lexical scope that were noted in this ticket.
from husk-scheme.
http://srfi.schemers.org/srfi-72/srfi-72.html
from husk-scheme.
Yeah, that's an explanation of terms around the area of a syntax-case macro system. Implementing that would be good, but challenging.
from husk-scheme.
"Common Lisp went with the pragmatic decision that the macro writer is responsible for the 'hygiene'", this is correct only for the easy side of hygiene that is solved with a gensym. The other side (where bindings in the use site shadow bindings in the macro definition site) is hard to solve and requries a global solution.
See: http://tmp.barzilay.org/tutorial.txt | Breaking Hygiene
Specifically:
Hygienic macros avoid variable capture of two kinds:
- names that are introduced by the macro do not clash with names in
sub-expressions that are passed from user code to it -- for example,
we use temporary variable names without worrying whether
subexpressions use the name,- names that the macro references are coming from the lexical context of
its definition, rather than the lexical context of its use. For
example, if a macro usesif'
, then the definition ofif'
that was in
effect at the context where the macro is defined is used.
Clinger and Rees present an algorithm to solve both capture problems in Macros That Work:
http://mumble.net/~jar/pubs/macros_that_work.ps
from husk-scheme.
That work is pretty old -- there was a lot since then. IMO, it's best to read about the syntax-case
macro system, if you want to do the right thing.
from husk-scheme.
You make a good point, syntax-rules
is older and does not support low level macros. But it is also part of
R5RS and R7RS (small language draft), which husk is targeting, while syntax-case
is not. I need to walk before I can run on this. I'll add another ticket to include syntax-case
in a future release...
from husk-scheme.
Hygienic macro support has been added to the husk 3.4.x series using syntax-rules
. Both "sides" of hygiene are included, and husk now passes all tests from this ticket as well as many more from the test suite. Macros will continue to be tested and refined before this ticket is closed out.
from husk-scheme.
This work is essentially complete except an issue with define
noted here: #65
I am interested if you have any other test cases for macros that are not transformed correctly... otherwise this issue is going to be closed out soon.
from husk-scheme.
I'd play with it more, but dealing with Haskell is difficult for me ATM.
from husk-scheme.
No problem - I am closing this ticket since hygiene is implemented now, minus an outstanding issue or two that are already being dealt with under separate tickets. If you ever do have a chance to double-check and see something that is not working, please let me know.
Thanks for your time.
from husk-scheme.
Related Issues (20)
- Reader hangs with or/define/cond combination HOT 3
- Add call history reporting for compiled programs
- Add a husk header to the user manual
- Issues from R7RS Considered Unifier of Previous Standards ∗ HOT 4
- Extraneous trailing parentheses are allowed HOT 2
- Non sense error when trying to load SRFI-13 reference implementation HOT 6
- Implement "hash-table-ref/default" in SRFI-69 HOT 2
- "format" fn from SRFI-28 broke some non-standard ASCII chars (UTF-8 set) HOT 2
- Error during macro expansion when referencing another non-exported variable from library HOT 1
- Build with -fuseffi fails HOT 6
- Hardcoded quote
- Problem importing definitions that are in (scheme) but not (scheme base) HOT 4
- ghc-8.6.5 HOT 5
- Problem building HOT 2
- Return value to shell on errors is not always set.
- News article HOT 2
- Build failures with GHC 9.0.1
- Cannot find load file if loading from another directory
- 9.6.1 HOT 1
- Build failures with ghc 9.8.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from husk-scheme.