# AbstractChar (and #26286)

**URL:** https://discourse.julialang.org/t/abstractchar-and-26286/9435
**Category:** Internals & Design
**Created:** [March 2, 2018, 12:01am UTC](https://discourse.julialang.org/t/abstractchar-and-26286/9435 "2018-03-02T00:01:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)
#### Post date: [March 2, 2018, 12:01am UTC](https://discourse.julialang.org/t/abstractchar-and-26286/9435/1 "2018-03-02T00:01:44Z")

</div>

[https://github.com/JuliaLang/julia/pull/26286#issuecomment-369771199](https://github.com/JuliaLang/julia/pull/26286#issuecomment-369771199)  
@stevengj you said that you didn’t understand the need for CodePoint.

Take a look at the README and the code where I define CodePoint, it is used throughout the package:  
[https://github.com/JuliaString/Strs.jl](https://github.com/JuliaString/Strs.jl)

`CodePoint` allows one to have separate code point types for ASCII, Latin1, UCS2 (BMP only Unicode), and UTF32 (full _valid_ Unicode), as well as other types to represent “raw” 1, 2, 4 byte text values, or binary values.  
That way optimized code can be generated for things like `isvalid` or `isascii`.

I’d rather though that (for now at least) `CodePoint` were left out of base, and just have `AbstractChar` for now, which would be the supertype of both `Char` from Base and my own `CodePoint`.

---

<div class="post-metadata">

### Author: ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)
#### Post date: [March 2, 2018, 3:32pm UTC](https://discourse.julialang.org/t/abstractchar-and-26286/9435/2 "2018-03-02T15:32:52Z")

</div>

> Alternatively, we could define print to always output UTF-8, and write to output a raw encoded value.

@stevengj That would fit with what I’ve been implementing. Not being about to directly read/write strings with other encodings would be horrible.  
Having `print` defined as outputting UTF-8 encoded strings seems like a good way of having both low-level and high level handling of string I/O.

---

<div class="post-metadata">

### Author: ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)
#### Post date: [March 3, 2018, 12:06am UTC](https://discourse.julialang.org/t/abstractchar-and-26286/9435/3 "2018-03-03T00:06:07Z")

</div>

> To do this efficiently while still supporting streams in different encodings, you’d ideally want an ASCIIChar type.  
> (from at-stevengj)

That was one of the first things I did when designing the `Strs.jl` package.  
It does make things much more efficient.
