On Sunday, 23 June 2013 at 16:07:05 UTC, Andrei Alexandrescu
wrote:
Still buggy. The empty string must be a prefix of any string
including the empty string.
Huh. Well, that makes sense. Just change while to do while and
you've got that. Probably compiles to exactly the same code as
your implementation in the link at that point.
But this probably told you more about my methods than getting it
right the first time would have: I'll just slap something
together that's good enough for the test case(s) fed to it and
then change it if new stuff arises where it fails. One of the
nice things about software is you generally don't have to get it
right the first time since it is so easy to change.
This is TDD-lite isn't it! lol
http://www.serversidemagazine.com/news/10-questions-with-facebook-research-engineer-andrei-alexandrescu/.
I definitely remember reading that when you posted it a while ago
because I have code that does that <?d writeln("hello, world");
?> laying around.
http://arsdnet.net/dcode/dhp.d
It works by just reading the file and translating everything
outside the <?d?> into a giant writeln(string literal), pasting
in the D code, then compile+running it, inserting a bunch of
imports so it works.
dom.d now supports those kinds of tags, it could probably be even
nicer, especially with a D lexer so it doesn't think "?>" is the
same as ?>. But as I'm sure I said then, this is a bad idea
anyway since mixing code and html data leads to ugliness, whether
the code is php or D.