[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2017-09-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5719

Simen Kjaeraas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||simen.kja...@gmail.com
 Resolution|--- |FIXED

--- Comment #10 from Simen Kjaeraas  ---
Examples given by Rob Jacques work in D today.

--


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2012-05-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719



--- Comment #8 from meh. m...@paranoici.org 2012-05-19 04:14:25 PDT ---
Created an attachment (id=1106)
Reduced test case for weird cast behavior.

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


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2012-05-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719


meh. m...@paranoici.org changed:

   What|Removed |Added

 CC||m...@paranoici.org


--- Comment #9 from meh. m...@paranoici.org 2012-05-19 04:17:51 PDT ---
Sorry for that, bugzilla did something funny, I don't know why it attached that
to this bug.

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


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2011-10-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719



--- Comment #3 from Kenji Hara k.hara...@gmail.com 2011-10-09 03:42:53 PDT ---
(In reply to comment #2)
 https://github.com/D-Programming-Language/phobos/pull/118
 https://github.com/D-Programming-Language/phobos/pull/119
 https://github.com/D-Programming-Language/phobos/pull/122

The three pull requests are already merged, and now std.conv.to supports both
two kinds of custom conversions:

1) object to non-object conversion with opCast
   to!T(s)
   -- s.opCast!T()

2) non-object to object conversion with construction
   to!T(s)
   -- new T(s) // if T is class
   T(s) // if T is struct

Today, is this a closable issue?

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


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2011-10-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719



--- Comment #5 from Jonathan M Davis jmdavisp...@gmx.com 2011-10-09 14:25:50 
PDT ---
Structs are very much objects. Whether something is an object or not has
nothing to do with whether it's a reference type or a value type. Take C++ for
example. In C++, classes are generally value types rather than reference types,
but they're very much objects. The same goes for whether an object is
polymorphic or not. It's an object regardless of whether it's polymorphic. The
concept of an object in OO programming has nothing to do with the difference
between a struct and a class in D.

You're going to confuse people and generally be confused by others if you refer
to instances of structs as if they weren't objects. If you want to be clear
about the differences between structs and classes, you need to refer to structs
and classes and not try and use the term object to differentiate them.
Instances of both are objects.

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


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2011-10-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719


Brad Roberts bra...@puremagic.com changed:

   What|Removed |Added

 CC||bra...@puremagic.com


--- Comment #6 from Brad Roberts bra...@puremagic.com 2011-10-09 16:34:26 PDT 
---
Careful, given that the name of the entity at the root of the hierarchy of
classes is called 'Object', which structs have no relationship to, there is an
ambiguity in terminology.

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


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2011-10-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719



--- Comment #7 from Jonathan M Davis jmdavisp...@gmx.com 2011-10-09 16:48:59 
PDT ---
True, there's a difference between something which is an instance of Object and
something which is an object. But D structs are still very much OO and are
definitely objects.

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


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2011-07-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719



--- Comment #1 from Rob Jacques sandf...@jhu.edu 2011-07-01 13:04:20 PDT ---
I've noticed that with generic code that

Target toImpl(Target, Source)(Source value)
if (implicitlyConverts!(Source, Target))

can cause an error via multiple template matches with

T toImpl(T, S)(S value) if (is(S : Object)  is(T : Object))

and

T toImpl(T, S)(S value)
if (((is(S : Object)  !is(T : Object)) || is(S == struct))
 !isSomeString!T  is(typeof(S.init.to!(T)()) : T))

Both issues can be simply fixed by adding an additional template constraint:
 !implicitlyConverts!(S,T)

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


[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

2011-07-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5719


Jonathan M Davis jmdavisp...@gmx.com changed:

   What|Removed |Added

 CC||jmdavisp...@gmx.com
   Severity|normal  |enhancement


--- Comment #2 from Jonathan M Davis jmdavisp...@gmx.com 2011-07-01 13:12:48 
PDT ---
There are several pull requests affect std.conv.to at the moment which will
change the situation and which will likely be merged in soon. Among other
things, they get rid of the member function to conversion and make std.conv.to
work with overloaded opCast.

https://github.com/D-Programming-Language/phobos/pull/118
https://github.com/D-Programming-Language/phobos/pull/119
https://github.com/D-Programming-Language/phobos/pull/122

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