# Slice type coercion

**URL:** <https://ziggit.dev/t/slice-type-coercion/18168>\
**Category:** Explain\
**Tags:** zig-0-17\
**Created:** [November 1, 2026, 2:21am UTC](https://ziggit.dev/t/slice-type-coercion/18168 "2026-11-01T02:21:43Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![npc1054657282](https://ziggit.dev/user_avatar/ziggit.dev/npc1054657282/32/5790_2.png) [@npc1054657282](https://ziggit.dev/u/npc1054657282)\
**Post date:** [November 2, 2026, 12:58pm UTC](https://ziggit.dev/t/slice-type-coercion/18168/6 "2026-11-02T12:58:45Z")

</div>

1. This is roughly the definition of a subtype: every possible value of type A is still valid under the semantics of type B, so it’s okay to coerce from A to B.  
Subtypes allow information loss. E.g., losing mutability information when coercing from `*T` to `*const T`. Losing actual alignment information when coercing from `*align(64) T` to `*align(1) T`. Losing the actual range of values when coercing from `u32` to `u64`.

But I agree, allowing a coercion from `[]T` to `[*]T` is a bit far-fetched and unnecessary. `slice.ptr` feels more explicit and better to me, and I’ve actually never used this coercion, so I wouldn’t mind if it were removed.

1. Comptime `[]T` is considered equivalent to `[N]T`, [#35328](https://codeberg.org/ziglang/zig/issues/35328) might help a bit in understanding this. The post I recently discussed about `[_]T` also happens to mention the use of slices at comptime, which might eventually be used to completely replace the `[_]T` syntax.

> [@\#19674 is rejected but #5038 is accepted](https://ziggit.dev/t/19674-is-rejected-but-5038-is-accepted/18107):
>
> I used to think that [#19674](https://github.com/ziglang/zig/issues/19674) was a prerequisite for [#5038](https://github.com/ziglang/zig/issues/5038). When #5038 was accepted, I thought #19674 would be accepted soon, but to my surprise, it was recently rejected. Does this mean the appearance of other alternatives?

---

_[View the full topic](https://ziggit.dev/t/slice-type-coercion/18168)._
