On Wed, Jun 27, 2012 at 7:49 PM, Jonathan M Davis <[email protected]>wrote:
> On Wednesday, June 27, 2012 19:47:41 Gor Gyolchanyan wrote: > > On Wed, Jun 27, 2012 at 7:41 PM, Jonathan M Davis > <[email protected]>wrote: > > > On Wednesday, June 27, 2012 17:58:46 Gor Gyolchanyan wrote: > > > > I tested it out and the string literal without qualifiers counts as a > > > > dstring. > > > > > > That depends entirely on what you assign it to. > > > writeln(typeof("hello").stringof) prints string, not dstring. So, the > > > literal > > > by itself is a string by default. > > > > > > - Jonathan M Davis > > > > this is weird. I wrote a function, which transforms anything, which > > qualifies as isForwardRange into an implementation of ForwardRange. And > the > > type inference of that function produced a ForwardRangeImpl!dchar when I > > passed it a string literal. > > > > Although string and wstring also qualify as a forward range. > > _All_ strings are considered to be ranges of dchar. That's why string and > wstring are not random access ranges and hasLength is false for them. > > - Jonathan M Davis > So why is the type of a string literal _string_ by default? Isn't it confusing when dealing with ranges? -- Bye, Gor Gyolchanyan.
