Bug 9810 – Fact that type tuples contain not only tupes isn't documentated

Status
NEW
Severity
normal
Priority
P3
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-24T23:26:46Z
Last change time
2024-12-15T15:22:06Z
Keywords
spec
Assigned to
No Owner
Creator
Denis Shelomovskii
Moved to GitHub: dlang.org#4022 →

Comments

Comment #0 by verylonglogin.reg — 2013-03-24T23:26:46Z
Type tuples and its slices contain also other information which is neither obvious nor documented: --- void f(int) { } void g(ref int) { } static if(is(typeof(f) Pf == function) && is(typeof(g) Pg == function)) { // Indexing returns types, everything is clear: static assert(is(Pf[0] == Pg[0])); static assert(is(void function(Pf[0]) == void function(Pg[0]))); // This only means corresponding types are equal, not tuples: static assert(is(Pf == Pg)); // Tuples and its slices are different: // (Pg contains information that its first type is `ref`) static assert(!is(void function(Pf) == void function(Pg))); static assert(!is(void function(Pf[0 .. 1]) == void function(Pg[0 .. 1]))); } else static assert(0); ---
Comment #1 by robert.schadek — 2024-12-15T15:22:06Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/4022 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB