digitalmars.D.learn - Why is ElementType!(char[]) == dchar?
- Tofu Ninja (1/1) Jul 09 2016 Seems pretty silly to me...
- rikki cattermole (2/3) Jul 09 2016 http://dlang.org/phobos/std_range_primitives.html#.front
- ketmar (2/3) Jul 09 2016 due to universally beloved autodecoding.
- Tofu Ninja (3/6) Jul 09 2016 Hmmm... I dont really know the history of autodecoding, why was
- Tofu Ninja (4/11) Jul 09 2016 Hmm, well I fixed my problem that originally prompted me to ask
- rikki cattermole (8/20) Jul 09 2016 In this case, its not aut odecoding.
- ketmar (2/6) Jul 09 2016 hello, autodecoding.
- Adam D. Ruppe (4/7) Jul 09 2016 You have that backwards. foreach only decodes if you specifically
- H. S. Teoh via Digitalmars-d-learn (13/29) Jul 09 2016 [...]
- Lodovico Giaretta (4/16) Jul 09 2016 Another solution is to use ElementEncodingType, which is like
On 09/07/2016 11:24 PM, Tofu Ninja wrote:Seems pretty silly to me...
Jul 09 2016
On Saturday, 9 July 2016 at 11:24:01 UTC, Tofu Ninja wrote:Seems pretty silly to me...due to universally beloved autodecoding.
Jul 09 2016
On Saturday, 9 July 2016 at 11:29:18 UTC, ketmar wrote:On Saturday, 9 July 2016 at 11:24:01 UTC, Tofu Ninja wrote:Hmmm... I dont really know the history of autodecoding, why was that supposed to be a good idea?Seems pretty silly to me...due to universally beloved autodecoding.
Jul 09 2016
On Saturday, 9 July 2016 at 11:35:24 UTC, Tofu Ninja wrote:On Saturday, 9 July 2016 at 11:29:18 UTC, ketmar wrote:Hmm, well I fixed my problem that originally prompted me to ask this by using ubyte instead of char. Still kinda curious on the whole autodecoding thing and why it's even a thing.On Saturday, 9 July 2016 at 11:24:01 UTC, Tofu Ninja wrote:Hmmm... I dont really know the history of autodecoding, why was that supposed to be a good idea?Seems pretty silly to me...due to universally beloved autodecoding.
Jul 09 2016
On 09/07/2016 11:46 PM, Tofu Ninja wrote:On Saturday, 9 July 2016 at 11:35:24 UTC, Tofu Ninja wrote:In this case, its not aut odecoding. ElementType is using std.range : front for array's since they do not provide a front method. That implementation is weird in that it returns a dchar instead of the raw type. Which is decoding, but it is not auto decoding. Auto decoding involves the foreach statement. So std.traits : ForeachType if that returned dchar then yes that would be because of auto decoding.On Saturday, 9 July 2016 at 11:29:18 UTC, ketmar wrote:Hmm, well I fixed my problem that originally prompted me to ask this by using ubyte instead of char. Still kinda curious on the whole autodecoding thing and why it's even a thing.On Saturday, 9 July 2016 at 11:24:01 UTC, Tofu Ninja wrote:Hmmm... I dont really know the history of autodecoding, why was that supposed to be a good idea?Seems pretty silly to me...due to universally beloved autodecoding.
Jul 09 2016
On Saturday, 9 July 2016 at 11:57:36 UTC, rikki cattermole wrote:In this case, its not aut odecoding. ElementType is using std.range : front for array's since they do not provide a front method. That implementation is weird in that it returns a dcharhello, autodecoding.
Jul 09 2016
On Saturday, 9 July 2016 at 11:57:36 UTC, rikki cattermole wrote:That implementation is weird in that it returns a dchar instead of the raw type. Which is decoding, but it is not auto decoding. Auto decoding involves the foreach statement.You have that backwards. foreach only decodes if you specifically ask for it (by specifying wchar or dchar in the statement). Phobos does it automatically, whether you like it or not.
Jul 09 2016
On Sat, Jul 09, 2016 at 11:57:36PM +1200, rikki cattermole via Digitalmars-d-learn wrote:On 09/07/2016 11:46 PM, Tofu Ninja wrote:[...] Actually, this is exactly what autodecoding is about. The .front of string and wstring are always decoded to dchar. A long time ago when this was first written it was deemed a good idea, but over the years experience has shown that it was a bad design (though some may argue this point). Nowadays we're trying to steer away from it, but due to the large amount of Phobos code that depends on it, it's probably here to stay for the next little while yet. (My hope is that eventually it will become irrelevant and deprecable... but we're far from that right now.) T -- What doesn't kill me makes me stranger.On Saturday, 9 July 2016 at 11:35:24 UTC, Tofu Ninja wrote:In this case, its not aut odecoding.On Saturday, 9 July 2016 at 11:29:18 UTC, ketmar wrote:Hmm, well I fixed my problem that originally prompted me to ask this by using ubyte instead of char. Still kinda curious on the whole autodecoding thing and why it's even a thing.On Saturday, 9 July 2016 at 11:24:01 UTC, Tofu Ninja wrote:Hmmm... I dont really know the history of autodecoding, why was that supposed to be a good idea?Seems pretty silly to me...due to universally beloved autodecoding.
Jul 09 2016
On Saturday, 9 July 2016 at 11:46:14 UTC, Tofu Ninja wrote:On Saturday, 9 July 2016 at 11:35:24 UTC, Tofu Ninja wrote:Another solution is to use ElementEncodingType, which is like ElementType but with a special hack for arrays of characters, to return the actual type and not the autodecoded one.On Saturday, 9 July 2016 at 11:29:18 UTC, ketmar wrote:Hmm, well I fixed my problem that originally prompted me to ask this by using ubyte instead of char. Still kinda curious on the whole autodecoding thing and why it's even a thing.On Saturday, 9 July 2016 at 11:24:01 UTC, Tofu Ninja wrote:Hmmm... I dont really know the history of autodecoding, why was that supposed to be a good idea?Seems pretty silly to me...due to universally beloved autodecoding.
Jul 09 2016