Best error msg ever
Nemanja Boric via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 10 04:41:21 PST 2017
On Friday, 10 February 2017 at 04:02:17 UTC, Era Scarecrow wrote:
> On Friday, 10 February 2017 at 02:53:50 UTC, Era Scarecrow
> wrote:
>> Seems the built in Date class wasn't the same as the Sql.Date
>> that was being used (but had the same name). Apparently it
>> took like 2 hours to figure out what was going on.
>
> Oh right forgot to mention one important detail. In Java the
> program compiled without errors; It was when it was trying to
> be used that it would crash unexpectedly. Refusing to compile
> is slightly better than crashing unexpectedly later.
I saw it happen with D as well: everything compiles, everything is
fine, and suddenly segfault. The issue was caused by template
argument, two
modules with the same name, but from different packages (think
`myalib.blah.morebla.foo` and `myblib.blah.morebla.foo`) and a
cast
somewhere in the middle of the callstack which casted the first
template argument to the second one, where the `myalib`'s foo was
casted to `myblib`'s interface.
Worse of all, `myalib` and `myblib` were just mentioned in the
imports,
far away from the call site.
More information about the Digitalmars-d
mailing list