네, 절대 안 바뀌는 테이블이면 enum 쓰는 게 맞아요. 근데 enum은 ctfe를 강제해서, parseServices의 모든 경로가 컴파일 타임에 실행될 수 있어야 해요. smtp 25 줄이 에러 분기로 들어가는데, 거기서 stderr.writeln은 실행할 수 없어요.
대신 Exception을 throw하거나 assert(0, msg)를 쓰세요. 컴파일러가 그 메시지를 빌드 에러로 출력해 주니까 원하는 동작일 거예요.
ci.sh는 별개 문제예요. import()를 쓰려면 ldc2에 -J.가 필요해요. 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.