Error message for a private identifier in an imported module (was: Bug tracker best practices)

Thomas Kuehne thomas-dloop at kuehne.cn
Wed Jun 27 02:29:39 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stewart Gordon schrieb am 2007-06-26:
> "Oskar Linde" <oskar.lindeREM at OVEgmail.com> wrote in message
> news:f5ojv9$13sj$1 at digitalmars.com...
><snip>
>>> 2 - std.random.index is private so it's not likely I am actually trying
>>> to modify it.  I think I should get the error:
>>> "C:\D\src\tmp\bug001.d(2): Error: undefined identifier index"
>>> instead.
>>
>> Compiler error messages are a tricky business. What if you were actually
>> trying to refer to a private identifier in another module.
>
> Debatable indeed.  But my thought is: if it's another module, why should you 
> be aware that this private identifier exists?
>
> If an identifier is declared as private, it is strictly part of the module's 
> internal workings.  Its creator never intended it to be _seen_ outside of 
> the module, let alone accessed.

This might be what you expect, but in D "private" is always visable but
not accessable outside of the modle it was defined in.

Yes, this behaviour might be unexpected for many but has been so for a long
time.

Thomas


-----BEGIN PGP SIGNATURE-----

iQIVAwUBRoIt+rZlboUnBhRKAQLZVhAA65ko7RSG1sG3ETptnBDeZ3RaApgCOu4x
8TRweTMNKiyNe2Qz3vHTxygJkS9ZesJwcO8T1mKQZ9nt80rUi9xfQl2gnKf5zS+Y
+EPLbQpQScmVcrUgUcq5MhmhLGeWZKJKTLmRlWD6DeyroyS9eLio41TAS03t32bh
rFghzJ+JPY6L0qJilQ4NPrTqPtWT+4Bi8F7mD23ZVhQf9yU6qaRq4Rf7sTSACMij
FHVPS30C/mACkNDlccfPbQuhns2H5HMBkWihIqTFw2QUyrC74pUJn51D1SRojmQr
KcdTgMtqii26ahqbTJTzAwdMS7rapKKhiI/Rxpxyf/njrLHrw+uArS9sb7BNwJV9
5dtSiOGca85xitoTxmMVaVasvACWtgyGZ78H6kehLS50BlHrch5P6qxh9UPKNE7H
3NXoifsHpg463cPzZFqllcgzbPUI8nVmFCFgOsab3A3hI6FwdUIfMKsAQn8v/vP5
ozx7xHLjwhFP/fcnwzZqXDKnYm8A4cErJMs9SytwQu7rpRnq0zwcUwyOm2wEMtUA
qZuMI0bRqY1uL5h4owNCyKg+q7LfCsITdsArpsXLVNxz2rmugvXvMS+cP2B8GsLn
lFwtDFOJ0XZ3iDF6+E0p4GiX/3R3HIxU2aKEdh6Vtg/9BxfYPqIrtgdi4KilBj+w
9PBZcaVqCZY=
=o/q4
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list