Comments (4)
Well I've tried to mine my memory and notes for some clever reason I ordered the tags this way but I can't find anything 😄
Seems like a hole in the logic.
I'll fix this shortly, unless you are interested in submitting a PR?
from book.
I'm not sure what your preferred solution to this problem would be, but I've seen at least couple from things I've looked into:
- Statically allocate an arbitrary "nil" object (I've seen some Lisps that do this, and do pointer comparison with this object to determine if a value is "nil", or "the empty list")
- Use a tag value to represent a kind of "second order" tag. This way, you can have extra bits dedicated to another tag enum, and represent a whole bunch of things in the pointer, such as constants (like
nil
,true
,false
), and other types that would fit within a usize (like 8 and 16 bit integers). This has the obvious downside that you'd lose a tag that you could otherwise use for something else. - Maybe use an object tag pointing to 0x0 (so it would be a constant pointer of 0x3)?
I'm sure that there are a multitude of other options
from book.
The most obvious option to me is to reassign tags such that nil
is a Symbol
with a pointer value of 0x0. PR #52 should show what I mean.
I've considered option 1 to be a possible solution for keyword symbols in general. It would be a somewhat more involved solution, though there is already the SymbolMap
which could be prepopulated with keyword symbols. I haven't thought this through all the way, yet.
from book.
Yup, looks like a good solution to me!
from book.
Related Issues (20)
- Bump allocate downward HOT 3
- Support for large objects
- Support for range-limited integer arithmetic
- Support for big numbers
- Stop-the-world object tracing
- GC Sweeping
- Close up to 3 upvalues in one opcode
- Refactor towards nanopass style chaining
- Refactor parsing and compiler around List type
- Simplify internal pointer types
- Runtime type identification and tagged ptr types
- CellPtr and TaggedCellPtr can't be Copy because std::cell::Cell isn't copy
- In implementation of Array, replace Cell<RawArray> with RefCell
- Improve efficiency of fetching next opcode
- Inconsistent tense in writing
- Explain why a custom allocator is needed at start of the book HOT 2
- Why BlockMeta is stored on a Box on the BumpBlock struct? HOT 1
- Improve book readability with diagrams
- Rooting objects HOT 2
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 book.