Giter Club home page Giter Club logo

Comments (3)

gelisam avatar gelisam commented on August 29, 2024

Btw @david-christiansen , is there a specific reason why users are forbidden from defining their own identifiers starting with #%? We could allow those characters inside identifiers and then a #lang could choose to rename quote to #%quote. Currently a #lang cannot do that because #% are not valid identifier characters but the parser makes an exception for #%string and the other special primitives.

from klister.

david-christiansen avatar david-christiansen commented on August 29, 2024

The reason is that they represent hooks that are used to allow user interpolation of operators into a context that is not otherwise syntactically marked. Otherwise, the variable naming system can be used to override the meanings of named operators (e.g. quote or lambda).

The reason to not allow other #% names is just to prevent confusion about what they do, and catch typos earlier. There's not a way for users to add new interpolation points, after all.

from klister.

gelisam avatar gelisam commented on August 29, 2024

Thanks for the explanation, the part about avoiding typos makes a lot of sense.

I now see that identifiers have three levels of discoverability:

  1. Identifiers like lambda appear as-is in the code, e.g. (lambda (x) x) becomes (lambda (x) x). Users can thus easily look up that identifier in the documentation.
  2. Identifiers like quote are shortened to a small number of special character, e.g. (open-syntax 'foo) becomes (open-syntax (quote foo)). Users can thus look up the special character in the documentation, but this requires making sure the documentation's search bar supports those special characters.
  3. Identifiers like #%app and #%string are inserted around existing code, without any syntactic markers, e.g. (f "foo") becomes (#%app f (#%string "foo")). Users might thus struggle to find the identifier's documentation, and might not even realize that an extra macro call is added.

It thus seems useful to keep the number of #% identifiers to a minimum, so that the user can read the entire section on #% identifiers and remember all the places where they are inserted. Therefore, I now agree not to rename quote to #%quote.

from klister.

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.