[phobos] Historic background of std.regex and BacktrackingMatcher

Mai Lapyst mai at lapyst.by
Thu Oct 5 11:36:17 UTC 2023


I'm currently working through the dmd (and phobos for that 
matter), and come across it's regex implementation. Here I found 
out it makes rather heavy usage of malloc / pureMalloc; on one 
side to allocate the Matcher implementation inside 
`GenericFactory`; on the other side in `BacktrackingMatcher` for 
memory of it's stack.

Is there any historic reason why it dosnt uses more D-like 
features like `new` or dynamic arrays? It would certainly be 
safer to do so than using an untyped region of memory as 
stack-space.

Also: if it needs "plain" memory; would this code be a good 
candidate to utilize `std.experimental.allocator` once released?

Cheers,
Mai


More information about the phobos mailing list