[Issue 8486] Possibly wrong interaction of Variant and const arrays

2012-08-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8486



--- Comment #3 from cybevnm cybe...@gmail.com 2012-08-01 12:58:14 PDT ---
(In reply to comment #2)
 … the point being that this is, if anything, analogous to the constness of the
 Variant instance itself, not the contained type.

Unfortunately, Variant's handling of arrays is different to handling of class
references. So we have next situtation:

import std.variant;
class C { }
void main()
{
  {
const C c;
Variant v = Variant( c );
assert( v.peek!( typeof(c) )() != null );
  }
  {
const C[] cs;
Variant v = Variant( cs );
assert( v.peek!( typeof(cs) )() == null );
 }
}
But array top-level const cutting is understandable, it's the way it works in
all other places...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8486] Possibly wrong interaction of Variant and const arrays

2012-08-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8486



--- Comment #4 from klickverbot c...@klickverbot.at 2012-08-01 13:08:10 PDT 
---
I meant that Variant should regard e.g. const(T[]) and const(T)[] or const(T*)
and const(T)* equivalent, i.e. allow implicit conversion between them.

The fact that const is automatically stripped from arrays is not
Variant-specific, template functions generally work like that in D.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8486] Possibly wrong interaction of Variant and const arrays

2012-08-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8486



--- Comment #5 from cybevnm cybe...@gmail.com 2012-08-01 13:43:19 PDT ---
(In reply to comment #4)
 I meant that Variant should regard e.g. const(T[]) and const(T)[] or const(T*)
 and const(T)* equivalent, i.e. allow implicit conversion between them.

Agree, it will resolve the problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8486] Possibly wrong interaction of Variant and const arrays

2012-07-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8486


klickverbot c...@klickverbot.at changed:

   What|Removed |Added

 CC||c...@klickverbot.at


--- Comment #1 from klickverbot c...@klickverbot.at 2012-07-31 13:07:32 PDT 
---
Variant should generally ignore top-level const for »value types« (i.e. array
slices, pointers, integral types, …).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8486] Possibly wrong interaction of Variant and const arrays

2012-07-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8486



--- Comment #2 from klickverbot c...@klickverbot.at 2012-07-31 13:09:26 PDT 
---
… the point being that this is, if anything, analogous to the constness of the
Variant instance itself, not the contained type.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---