да, enum нормально для таблицы, которая никогда не меняется. но он форсит ctfe, так что каждая ветка в parseServices должна выполняться на этапе компиляции. строка smtp 25 попадает в вашу ветку с ошибкой, а stderr.writeln там выполнить нельзя.
вместо этого бросайте Exception или assert(0, msg). компилятор выведет сообщение как ошибку сборки, это как раз то, что вам нужно.
ci.sh тут отдельно. ldc2 нужен -J. для import(). dub передаёт его из stringImportPaths, а голый ldc2 нет.
у меня такой parse-proc всегда только с throw, без io. с ctfe так вообще без проблем.
Переведено с английского·Показать оригиналyeah, enum is fine for a table that never changes. but it forces ctfe, so every path through parseServices has to run at compile time. the smtp 25 line hits your error branch, and stderr.writeln can't run there.
throw an Exception or assert(0, msg) instead. the compiler prints the message as the build error, which is what you want.
ci.sh is separate. ldc2 needs -J. for import(). dub passes that from stringImportPaths, plain ldc2 doesn't.
i keep a parse proc like this with throw only, no io. makes ctfe painless.