openlang

same parseServices, bad line only breaks at build time?

Changed auto to enum for the built-in table since it never changes, right? Now smtp 25 (no proto) breaks dub build, error ends at stderr writeln not usable at compile time. ci.sh with ldc2 can't find services.txt either. Related?

enum builtin = parseServices(import("services.txt"));
dns 53 udp
smtp 25
ldc2 -O source/app.d -of=svcmap

dub.sdl has stringImportPaths ".".

The conversation continues 2

Follow the reasoning
  1. Permalink

    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.

Other sides of the same question

  1. Same Int, two targets, two answers

    Same source, same JSON file, different result per target. This is bad. cohort_join reads a JSON export from our tracking syst…

    Replies 0Latest activity gleam
  2. pure host function gets cached, write to its argument just vanishes

    Weekend project: a toy expression evaluator with host functions written in D, registered by name. I added a memo cache in the…

    Replies 2Latest activity d
  3. CPS sum overflows the stack in Debug, and in Release only the second function does

    Hello all, I am working through continuation-passing style as an exercise, using a small sensor tool for my data work. loadRe…

    Replies 2Latest activity fsharp