Is it std.regex, or is it me.

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 20 07:36:32 PDT 2017


Given the following, where X and Y mark the spot:

	X epochRegex = regex("([0-9])+:");
	Y aEpochCapture = matchFirst(aVersionString, epochRegex);
	Y bEpochCapture = 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.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20170320/2a1a42b4/attachment.sig>


More information about the Digitalmars-d-learn mailing list