Comments (4)
Once wasabiz and I discussed what picrin's internal representation of unicode would be. There are some pros of UTF-8 and several cons of UTF-16 (or UTF-32).
- As picrin is a lightweight implementation, memory consuming UTF-16 (or UTF-32) is not suitable.
wchar_t
is specified to be at least 16bit width, that means you cannot usewchar_t
to represent UTF-32- Because picrin uses ropes to hold strings, UTF-8's O(n) problem does not matter so much.
Thus remaining char and using UTF-8 will do, I think. How do you think @wasabiz ?
from picrin.
@KeenS Thank you. I agree with your opinion.
Some additions from my perspective:
- Caching UTF-32 sequences may boost performance of character-oriented operations, at the cost of memory efficiency as @KeenS pointed out.
- Strictly speaking,
wchar_t
is not for storing Unicode characters, but wide characters. The portable usage ofwchar_t
is treating it as an opaque type and not relying on its bit pattern.- Yes, the big three platforms all treat it as UTF-{16,32} code unit, but e.g. NetBSD doesn't.
from picrin.
Sounds nice. I don't mind changing string internal representation unless it compiles on freestanding environment. UTF-32 sequence is good for programs doing heavy string modifications, but I think such a case is no more than 1% of the total. Providing a different structure is rational.
from picrin.
Even if it breaks no-libc rule, if we can switch it off with macros, it'll probably be ok.
from picrin.
Related Issues (20)
- Many tests failing on OS X HOT 2
- simple example doesn't work HOT 2
- picrin segfaults HOT 1
- "invalid character at the seeker head" doesn't say anything HOT 1
- `equal?` has a bug HOT 1
- Wrong current-library in repl
- number->string and string->number do not round-trip correctly HOT 2
- string->number should not signal error
- srfi 1 test failing on OS X HOT 7
- `equal?` does not recognize dictionaries HOT 3
- Current picrin segfaults on `call/cc` when compiled with gcc and -O1 (or larger)
- Picrin REPL doesn't allow forward references HOT 1
- R7RS promise bugs (on corner cases) HOT 7
- Initialization of random number generator
- syntax-rules cannot generate symbol with quote syntax HOT 2
- Missing source files? HOT 1
- build fails on mac os HOT 3
- Is Picrin dead? HOT 2
- Botbot Acquired, link no longer works HOT 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 picrin.