A new class -->String

David B. Held dheld at codelogicconsulting.com
Wed Apr 4 09:00:43 PDT 2007


jinheking wrote:
> I want to make a Class like java's String Class.
> [...]

Well, I believe the intention is that when 'invariant' gets added to the 
language, we will get string thusly:

alias invariant char[] string;

Note that this leaves out all of the member functions that one expects 
from String.  However, with immutable strings, it is perfectly safe 
(and, perhaps, preferable) to implement all that functionality as free 
functions.  If there were a way to switch between method call and free 
function syntax, then this distinction would become moot (and maybe we 
will get that as well...).

Dave



More information about the Digitalmars-d mailing list