www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is it std.regex, or is it me.

reply Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
Given the following, where X and Y mark the spot:

	X epochRegex =3D regex("([0-9])+:");
	Y aEpochCapture =3D matchFirst(aVersionString, epochRegex);
	Y bEpochCapture =3D matchFirst(bVersionString, epochRegex);

If X or Y are const or immutable the code fails to compile. Only if
both X and Y are auto does this code compile. So question to the
audience: how do you do single assignment programming in D? Is it, in
fact, impossible to program with bindings rather than variables in D?

And yes this does seem to be a violation of the Principle of Least
Surprise.

--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Mar 20
parent Kagamin <spam here.lot> writes:
A file stream would be another example of a thing that can't be 
naturally const even if you opened it for reading.
Mar 20