Comments (3)
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.
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.
Thanks for the explanation, the part about avoiding typos makes a lot of sense.
I now see that identifiers have three levels of discoverability:
- 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. - 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. - 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)
- accidental variable capture HOT 12
- lowercase naming convention affects variable naming convention HOT 2
- kind-inference bug with primitive type constructors HOT 4
- The kind-checker allows types to be applied to too many arguments HOT 6
- Combine baseType, unaryType, and addDatatypePrimitive HOT 1
- kind-checking for type patterns HOT 7
- Improve export-rename syntax HOT 1
- Update commentary.md
- Complete the Guide
- Render the documentation HOT 1
- Convert the old test suite to golden files
- Merge HACKING.rst and commentary.md
- Suggest shifting imports
- Suggest valid constructor names
- organize the examples folder
- Discussion: Craft a Roadmap? HOT 15
- Automatic defunctionalization
- merge non-examples and failing-examples
- Randomize the task queue at every iteration
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 klister.