Wondering about errors…

Russel Winder russel at winder.org.uk
Mon May 27 08:22:30 PDT 2013


On Mon, 2013-05-27 at 13:51 +0200, Adam D. Ruppe wrote:
> Yeah, me too.

Phew, I'm so pleased it is not just me!

My problem was forgetting an import. I am using std.array.split in one
function and std.stdio.writef in a completely separate function. With
split imported correctly everything compiles and runs as expected and
required. Forgetting the import of split(*), I get:

wc.d(11): Error: undefined identifier 'split'
/usr/include/dmd/phobos/std/range.d(611): Error: static assert  "Cannot put a char[] into a Appender!(string)"
/usr/include/dmd/phobos/std/format.d(1436):        instantiated from here: put!(Appender!(string), char[])
/usr/include/dmd/phobos/std/format.d(1338):        instantiated from here: formatUnsigned!(Appender!(string), char)
/usr/include/dmd/phobos/std/format.d(1312):        instantiated from here: formatIntegral!(Appender!(string), ulong, char)
/usr/include/dmd/phobos/std/conv.d(100):        ... (13 instantiations, -v to show) ...
/usr/include/dmd/phobos/std/stdio.d(1784):        instantiated from here: writefln!(char, immutable(int),immutable(int),immutable(int),string)
wc.d(18):        instantiated from here: writefln!(string,immutable(int),immutable(int),immutable(int),string)

Which definitely results in a ***WTF***. How can a missing import cause
this insane error report? If I use -v it looks even worse.


(*) I am not a fan of importing all symbols from a module, so I always
use selective imports. Whilst Python has no problem with imports and
name spaces, Java, Scala, Groovy and D have horrible problems since the
import imports into the current namespace. Obviously C++ is just a
problem here due to textual inclusion rather than a module system.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130527/45ffd326/attachment.pgp>


More information about the Digitalmars-d mailing list