Bug 17272 – std.experimental.typecons.Final inconsistent behaviour with built-in arrays

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-03-24T00:00:13Z
Last change time
2024-12-01T16:29:56Z
Assigned to
No Owner
Creator
hsteoh
Moved to GitHub: phobos#10245 →

Comments

Comment #0 by hsteoh — 2017-03-24T00:00:13Z
Code: ----- import std.experimental.typecons; void main() { Final!(int[]) s; // s is a head const array... s.length = 5; // look, ma! I modified the array! assert(s.length == 5); // passes //s.ptr = null; // does not compile } ----- Firstly, it's questionable whether modifying array length should be allowed under Final. But secondly, if we're allowed to modify s.length then it's inconsistent to reject modifying s.ptr.
Comment #1 by robert.schadek — 2024-12-01T16:29:56Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10245 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB