www.digitalmars.com         C & C++   DMDScript  

D - char/wchar function parallelism

reply Russ Lewis <russ deming-os.org> writes:
Implementers of D function libraries will likely want to implement
different routines for char's and wchars.  Sure, you could implement all
of your string functions as wchar*'s, but that requires a pretty
terrible conversion process.  It would be cool if there was some syntax
where you could declare a single function in the code but it
automatically expands to two versions of it - a char version and a wchar
version.

Ofc, templates do this, but I'm looking for something that might work
w/o having to implement templates.  Maybe a special type that could only
be used as a function parameter or return type.

Brainstorms?
Aug 18 2001
parent "psheer AT icon DOT co DOT za" <nospam nospam.com> writes:
In article <3B7F3C46.5ADD0A83 deming-os.org>, Russ Lewis
<russ deming-os.org> wrote:
 Implementers of D function libraries will likely want to implement
 different routines for char's and wchars.  Sure, you could implement all
 of your string functions as wchar*'s, but that requires a pretty
 terrible conversion process.  It would be cool if there was some syntax
 where you could declare a single function in the code but it
 automatically expands to two versions of it - a char version and a wchar
 version.
 
 Ofc, templates do this, but I'm looking for something that might work
 w/o having to implement templates.  Maybe a special type that could only
 be used as a function parameter or return type.
 
 Brainstorms?
The D spec seems to frown on macros, but this is is a very good use for them. -paul -- Paul Sheer Consulting IT Services . . . Tel . . . +27 21 761 7224 Linux development, cryptography, recuitment, support, training http://www.icon.co.za/~psheer . . . . http://rute.sourceforge.net L I N U X . . . . . . . . . . . . The Choice of a GNU Generation
Aug 19 2001