Comments (6)
FWIW, 👍 for endianness
e.g. endianness.little
. I think endian
and endian.little
is my 2nd favorite, in the event that we think endianness
is too weird a word / to hard to type.
from chapel.
I really hope there aren't going to be any more systems that are neither little endian nor big endian, but the endianness
enum (whatever it is called) can handle such a thing, while a bool
cannot. (There are some historical systems that were mixed endian.)
from chapel.
I also recall the IO subteam discussing whether it should be an enum or not at the time (we just didn't talk as much about the name as we probably should have), so I'd be in favor of considering that question decided anyways
from chapel.
My gut preference was more towards endian.[little|big|native]
because it seemed closest to the English phrase "little endian" / "big endian". But a downside to that is that we currently have arguments named endian
that would need to change. Arguably not a reason to avoid considering it, but definitely a hassle.
It also occurred to me that user-facing interfaces that take an endianness could potentially be changed to avoid the enm in favor of a bool, as in:
proc foo(args...) { } // this would be the native endian overload
proc foo(args..., littleEndian: bool) { } // this version would let people choose big vs. little
but that has the downside of resulting in less self-documenting interfaces (unless using the keyword-based argument passing), and may very well have been discussed and dismissed in conversations I wasn't a part of (or have forgotten).
from chapel.
Planning to ask the team about this topic today
What is the API being presented?
ioendian
is an enum that lets the user device the endian-ness of binary data while reading or writing it.
The options are to choose from 'big', 'little', and 'native'
How is it intended to be used?
It is used as an argument to the fileWriter
and fileReader
types to determine the byte order as described above.
Ex:
f.reader().readBinary(i, ioendian.big);
It is used in the binarySerializers and deserializers and as a result in almost all serializers that use that interface.
Uses in Arkouda
3 uses as part of the binarySerializer and deserializer interface, all localized in
https://github.com/Bears-R-Us/arkouda/blob/d5925c02d2041b2697fe19de36673ee300437b65/src/compat/gt-131/ArkoudaIOCompat.chpl#L61
What's the history of the feature
This enum was introduced when we deprecated binary conversions in format strings used in formatted IO in Feb 2022 in #19163. At that point we used format strings like
var i: int;
f.reader().readf("%>8i", i);
where the >
meant that the data was read as if it was big-endian and <
would mean little-endian
Brad brought up that this does not follow our naming conventions and didn't receive design attention regards to the name during it's inception.
Lydia noted that the question of using an enum vs bool for deciding endianness has already been decided by previous sub-teams.
Are there known GitHub issues with the feature?
Just this issue regarding the naming
#23868
What do other languages do?
a. Python
Python uses the >
, <
, =
syntax to determine what endianness binary data is written or read as.
It is brought in by importing struct
Ex:
pack(">bhl", 1, 2, 3)
Which packs the stuff in big endian format as long ints.
We've moved away from binary format strings, so I doubt this is something we would want to take inspiration from.
However, python does have a way to check the byte order of the system that looks more relevant from a naming standpoint.
We can check the endianness of the system using sys.byteorder
which returns either little
or big
based on the system.
b. C/C++
There isn't really a universal way to deal with endianness
C++ has the following two functions:
uint16_t htons(uint16_t hostshort)
- converts host byte order to network byte order.uint16_t ntohs(uint16_t hostshort)
- converts network byte order to host byte order.
and users have their own functions usually that deal with checking endianness
c. Rust
Rust has a byteorder
crate that is analogous to determine the endianness when reading and writing.
It uses two enums BigEndian
and LittleEndian
which support methods for different types
d. Swift
For it's Int
, FixedWidthInteger
, and Int8
types, Swift has littleEndian
and bigEndian
properties which give the respective representations of those types
e. Julia
Julia doesn't seem to have great ways to handle endianness and uses other functions like hton
and ntoh
or bswap
like C++.
f. Go
Go provides the binary.byeOrder
interface which is very similar to Rust in the sense that it provide two types that implement it binary.LittleEndian
and binary.BigEndian
Are there features it is related to? What impact would changing or adding this feature have on those other features?
This would have a small impact on the binarySerializers and deserializers
How do you propose to solve the problem?
We have a bunch of different names that we can use for this enum along with what the elements of it would be called.
First up are the changes where only the name of the enum is changed and the elements remain the same.
- Just fix the casing and call it
ioEndian
endianness
endian
- This would require renaming some arguments, but not a big deal, just a hassle
endianKind
byteOrder
Finally we can also change the naming of the elements within it
byteOrder
but the elements arenativeEndian
,bigEndian
, andlittleEndian
Although most languages use "byte order" or some casing of that, I think endianness is my favorite.
If we want to align ourselves with other languages then option 6 might be what we want here.
from chapel.
Just noting here that we got unanimous support (11 votes from the team) for endianness
and that's what the new name is going to be.
from chapel.
Related Issues (20)
- [Feature Request]: Add several flags to increase the verbosity of `chpldoc` HOT 3
- What Sort module symbols should the Search module reexport? HOT 1
- [Bug]: `const` attached to vararg formal arguments allows their modification HOT 14
- [Bug]: Runtime Install Directory Not Created On Linux aarch64 HOT 8
- [Bug]: printchplenv and printchplbuilds give misleading output with prefix-based installs HOT 1
- [Bug]: doxygen docs fail to build on macOS 14.6.1
- [Bug]: Mentioning a generic type without invoking the type constructor results in asan failure
- [Bug]: mismatched make and gmake versions can cause strange build failures
- [Bug]: ignoring the yielded values from an interator results in leaked memory HOT 2
- [Bug]: `const ref` attached to vararg formal arguments allows their modification
- [Bug]: Can't modify an array passed as a part of a vararg with default intent HOT 4
- [Bug]: Interfaces are not correctly scoped inside generic functions
- Update code examples in HPC Carpentries entry for Chapel
- Should we automatically infer CHPL_LLVM_GCC_INSTALL_DIR?
- [Bug]: Ignoring an element from a tuple yielded from an iterator results in memory leaks
- [Bug]: erroneously creating an AstNode causes a segfault
- [Bug]: writeRange HOT 2
- [Bug]: `CHPL_ROCM_PATH` is set to the wrong ROCm installation path HOT 6
- [Bug]: Dockerfile does not include a CMD command
- [Bug]: `--print-chpl-settings` does not pick up changes from the compiler arguments HOT 4
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 chapel.