Git Product home page Git Product logo

Comments (13)

justinethier avatar justinethier commented on August 15, 2024

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.

elibarzilay avatar elibarzilay commented on August 15, 2024

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.

justinethier avatar justinethier commented on August 15, 2024

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.

justinethier avatar justinethier commented on August 15, 2024

Version 3.1 (now in the master branch) fixes issues with lexical scope that were noted in this ticket.

from husk-scheme.

justinethier avatar justinethier commented on August 15, 2024

http://srfi.schemers.org/srfi-72/srfi-72.html

from husk-scheme.

elibarzilay avatar elibarzilay commented on August 15, 2024

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.

justinethier avatar justinethier commented on August 15, 2024

"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 uses if', then the definition of if' 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.

elibarzilay avatar elibarzilay commented on August 15, 2024

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.

justinethier avatar justinethier commented on August 15, 2024

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.

justinethier avatar justinethier commented on August 15, 2024

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.

justinethier avatar justinethier commented on August 15, 2024

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.

elibarzilay avatar elibarzilay commented on August 15, 2024

I'd play with it more, but dealing with Haskell is difficult for me ATM.

from husk-scheme.

justinethier avatar justinethier commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.