Spilt `Tagged<T>` into a utility crate
Depends on #3837
This makes Tagged<T> be usable in boa_string and boa_engine.
Test262 conformance changes
| Test result | main count | PR count | difference |
|---|---|---|---|
| Total | 50,254 | 50,254 | 0 |
| Passed | 46,615 | 46,615 | 0 |
| Ignored | 1,634 | 1,634 | 0 |
| Failed | 2,005 | 2,005 | 0 |
| Panics | 0 | 0 | 0 |
| Conformance | 92.76% | 92.76% | 0.00% |
General discussion on utility crates: how do we want to go about handling utilities in general that's going to be best for maintenance in the long term?
Should we have one general boa_utils crate or a utils directory with individual crates hosted inside it (I'm thinking of icu4x's structure as an example). We could also extract SmallMap into the utils as well. Both Tagged and SmallMap could then be standalone crates unto themselves.
There's some benefits to taking the utils directory approach.
- The code is more modular.
- Offers the libraries for generic use case for the Rust ecosystem as a whole.
- Could provide some soft "marketing" for boa, so to speak.
There could be a pretty big negative around the maintenance complexity utility crates may cause and managing separate releases may actually end being a large headache. :confused:
Any thoughts?
Hmmm... Tagged<T> and SmallMap are very small (single file) so don't think it's going to need that much maintenance. Just a thought: we could put them in separate repos (like we do with ryu-js, and temporal_rs) may make it easier to separately publish the crates.
What does the rest of the team say? @jedel1043 @raskad @Razican
From my side, in general, if the crate / code makes sense outside Boa, then we should make it separate, so that others can benefit from it. If not, I would keep it in.
For this case, it seems these types could be used outside of Boa, and they have no dependency on the engine, so I would make them separate if it's not too much maintenance burden (and we don't forget to maintain them 😅)
I'm not sure what we should name the crate because tagged, tagged_ptr, tagged_pointer are all taken... Any ideas?
I think separating small utility crates to separate repos is arguably worse for us. I would be in favour of having either a boa_utils or an utils directory here, but having to maintain a whole repo for only a single Tagged data structure sounds counter-productive.
From my side, in general, if the crate / code makes sense outside Boa, then we should make it separate, so that others can benefit from it. If not, I would keep it in.
We can do that and also maintain it as a separate crate on our main repo. That's what the ICU4X folks do with writeable, yoke, etc. and it's not too bad. I think it only makes sense to extract separate repos if there's a big incentive to do so.
As mentioned above, I'd be for the utils directory with any small utility crates in them.
I'm not sure what we should name the crate because
tagged,tagged_ptr,tagged_pointerare all taken... Any ideas?
tagged_rs maybe? tag_ptr could work although not super accurate 😕.
@boa-dev/maintainers This is done, just needs review/merge :)
Removed the assertions because I realized the pointer could be unaligned even if the type must be aligned (std::mem::read_unaligned). That by itself cannot cause undefined behaviour though; at worst some memory leaks, but unaligned pointers will just be treated as integers.