www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D's concatenation symbol (~) doesn't treat wchar[] and dchar[] as equal citizens with char[]

reply David L. Davis <SpottedTiger yahoo.com> writes:
Recently I've been trying to expand my ( bright :)) ) horzions beyond the char[]
8-bit universe, and use "D" to write code that's more useful to the "D"
International Community by using wchar[]s. Which just a few months ago, I had
decided to change to "D" as my secondary programming language from "C", because
of its fantastically simple use of build-in strings, its minimum need for
pointers, and while still retaining the "Full Power of C!!" ( Great Language
Walter! )

But sadly, it seems that D's concatenation symbol (~) doesn't treat wchar[] and
dchar[] as equal citizens with char[], below are a few examples:



































It would sure be great it if we had the w"This is" ~ w" a test!" and d"This is"
~ d" a test!" that Jill had mentioned in one of her many Unicode posts...this
would truly make for cleaner code, and to help equal things out a bit between
the three character types. Also it would be nice, if the w"" and 
d"" were to be added to "D", that they would also work well with the r"\", maybe
as wr"\" and dr"\". 

Plus there are many other issues beyond the core language, when you're trying to
use Phobos runtime functions with wchar[] or dchar[], but I think we need to
start focusing on how to fix the problem first in core langauge, and then worry
about the runtime library.

If I'm totally off my rocker, I'm sure someone here will let me know. :))

David L.

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Sep 03 2004
next sibling parent Sean Kelly <sean f4.ca> writes:
In article <cha4gq$1omo$1 digitaldaemon.com>, David L. Davis says...
But sadly, it seems that D's concatenation symbol (~) doesn't treat wchar[] and
dchar[] as equal citizens with char[], below are a few examples:
This sounds like a bug. If string literals are supposed to be implicitly convertible to all the string types then concatenation should not be an exception. Sean
Sep 03 2004
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
David L. Davis wrote:

<snip>
 It would sure be great it if we had the w"This is" ~ w" a test!" and 
 d"This is" ~ d" a test!" that Jill had mentioned in one of her many 
 Unicode posts...this would truly make for cleaner code, and to help 
 equal things out a bit between the three character types. Also it 
 would be nice, if the w"" and d"" were to be added to "D", that they 
 would also work well with the r"\", maybe as wr"\" and dr"\".
<snip> As I understand it, string literals are supposed to be at least quadruple-typed: char[], wchar[], dchar[], char*. Possibly wchar* and dchar* as well. http://www.digitalmars.com/d/ctod.html#ascii All we need is for the concatenation expression to be triple-typed to match. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Sep 03 2004