import std.traits. std.string;
DigitalDesigns
DigitalDesigns at gmail.com
Sat Jun 16 01:40:22 UTC 2018
On Saturday, 16 June 2018 at 00:34:01 UTC, H. S. Teoh wrote:
> On Sat, Jun 16, 2018 at 12:24:42AM +0000, DigitalDesigns via
> Digitalmars-d wrote:
>> space is ignored! Seems like a bug std . traits . std . string
>> is valid?
>
> It's not a bug. The '.' is the member-access operator, and
> like all other operators, is allowed to be surrounded by
> spaces. (Even though most people don't write it that way.)
>
>
> T
So, what you are saying is that if one does
import std.traits. std.string;
the compiler is parsing that as valid code? Let me ask you why
you think it is allowed. Is it because it just is or because that
is the mathematically correct behavior that should be allowed?
BTW, we are not talking about general member access but in
imports where it can lead to bugs:
import std.traits. foo;
import std.traits.foo;
rather than
import std.traits, foo;
which is most likely what the user desired.
Also, The only time I have ever see people use . is to break on a
line. Seems that the rules could be more specific and still get
all the functionality that people need without creating potential
sources of bugs.
. in import cannot have spaces.
. as member access cannot have spaces unless it starts the line.
.atom
.go
.now
rather than .
atom
. go .
now
Enforcing a little clarity in the language is not a bad thing.
More information about the Digitalmars-d
mailing list