Re: DMD Callstacks
On Monday, 23 October 2017 at 12:41:09 UTC, Márcio Martins wrote: What is everyone doing to get proper file name and line number info for callstacks with DMD? addr2line just gives me ??:0 You could try compiling with the -debug-switch. Of course if this turns out to be the fix, it doesn't help with std code.
Re: Dynamically import() files
On Monday, 23 October 2017 at 20:13:20 UTC, Igor wrote: On Monday, 23 October 2017 at 12:15:17 UTC, Andre Pany wrote: Hi, I have a folder "i18n" which contains message bundle files. For now it contains only the message bundle file written by the developer: "messagebundle.properties". [...] Can't you just create all the files that you expect to have and leave them empty and then you import them all and process them differently if there is no content? Thanks for the hints. I have some concerns creating the files upfront, because the files should only be created by other colleagues in an official translation process. I will check whether I can determine the files via script as proposed by Rikki. Kind regards André
Re: Dynamically import() files
On Monday, 23 October 2017 at 12:15:17 UTC, Andre Pany wrote: Hi, I have a folder "i18n" which contains message bundle files. For now it contains only the message bundle file written by the developer: "messagebundle.properties". [...] Can't you just create all the files that you expect to have and leave them empty and then you import them all and process them differently if there is no content?
Re: writeln double precision
On 10/23/2017 07:22 AM, Arun Chandrasekaran wrote: > void main() { > double a = 22/7.0; > import std.stdio: writeln, writefln; > writefln("%.51f", a); > } > But why does the compiler bring the C baggage for the integer > division? Why do I need to `cast (double)` ? I think you mean having to write 7.0 to bring a double into the expression. > Can't the compiler figure > it out? Yes, it can but we don't want that. Otherwise, the code would be too slippery to keep under control. For example, introducing the following temporary variable would change the semantics: // Before: foo(22/7); // After double temp = 22/7; foo(temp);// Is this the same call with the same value? Writing the above made me aware that function overloading would be too cumbersome as the compiler would find too many potential matches for the expressions. For example, should it convert 22/7 to float or double or long, etc. The rule is that every expression has a type and 22/7 is int. The rules are carried from C and can be tricky. Both "Integer Promotions" and "Usual Arithmetic Conversion" are interesting here: https://dlang.org/spec/type.html#integer-promotions Ali
Re: writeln double precision
On Monday, 23 October 2017 at 14:07:06 UTC, Arun Chandrasekaran wrote: I've written a simple tool [1] to find the DET and CMC specifically for biometrics performance measurement. When I generate the report, I expected to see high precision floating point numbers, but I see that writefln trims the precision to the last 6 digits after decimal point. Am I doing the right thing here? Should I use a different format specifier? [1] https://bitbucket.org/carun/biometrics-reports/src Cheers, Arun ``` void main() { double a = 22/7.0; import std.stdio: writeln, writefln; writefln("%.51f", a); } ``` and it prints all the decimals. So I'm happy that I have not lost the precision. But why does the compiler bring the C baggage for the integer division? Why do I need to `cast (double)` ? Can't the compiler figure it out?
writeln double precision
I've written a simple tool [1] to find the DET and CMC specifically for biometrics performance measurement. When I generate the report, I expected to see high precision floating point numbers, but I see that writefln trims the precision to the last 6 digits after decimal point. Am I doing the right thing here? Should I use a different format specifier? [1] https://bitbucket.org/carun/biometrics-reports/src Cheers, Arun
Re: DMD Callstacks
On Monday, 23 October 2017 at 12:54:33 UTC, Nicholas Wilson wrote: On Monday, 23 October 2017 at 12:41:09 UTC, Márcio Martins wrote: What is everyone doing to get proper file name and line number info for callstacks with DMD? addr2line just gives me ??:0 What OS, etc? Linux 64-bit (Ubuntu 16) DMD64 2.076.1
Re: DMD Callstacks
On Monday, 23 October 2017 at 12:41:09 UTC, Márcio Martins wrote: What is everyone doing to get proper file name and line number info for callstacks with DMD? addr2line just gives me ??:0 What OS, etc?
DMD Callstacks
What is everyone doing to get proper file name and line number info for callstacks with DMD? addr2line just gives me ??:0
Re: Dynamically import() files
Don't be afraid to write a small script that is run before a build to generate a list of files which than can be imported.
Dynamically import() files
Hi, I have a folder "i18n" which contains message bundle files. For now it contains only the message bundle file written by the developer: "messagebundle.properties". During the translation process additional message bundle files will be added to github: messagebundle_en.properties messagebundle_de.properties ... Changing the github content will automatically triggering the compilation process. My wish is, that every time a new message bundle file is added, these file is automatically included into the compilation process. I doubt, but is there a possibility to check during compile time which files exists in the i18n folder and import() these files? I see currently only 1 chance: Create a list of all possible language code (max 7) and check whether the import works via __traits(compiles,...). Something like: alias languages = TypeTuple!("en", "de"); static foreach(lang; languages) { ... } Kind regards André