Why can't a Regex object be immutable?

Shriramana Sharma via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 1 19:31:01 PST 2016


cym13 wrote:

> Is it that you
> can't make an immutable regex()? In that case it is a
> runtime-related issue and those variables just have to be
> mutable. Or is it that you want to be able to use an immutable or
> const regex (be it from regex() or ctRegex!()) with matchAll()?
> In the latter case it is matchAll's fault for not garanteeing the
> immutability of the regex (and may even qualify as a bug IMHO)
> but you can « cast(Regex!char)numbers » it if you must so it
> isn't hard to work arround it.

Yes after your comments I realized that it's not so much that I cannot 
create an immutable or const symbol referring to a Regex object but that I 
cannot use it with matchAll etc. But of what use is a Regex object if it 
cannot be used with matchAll etc?

-- 
Shriramana Sharma, Penguin #395953


More information about the Digitalmars-d-learn mailing list