Since dmd 2.096.0: import `x.t` is used as a type

kdevel kdevel at vogtner.de
Sun May 2 15:41:13 UTC 2021


On Saturday, 1 May 2021 at 16:32:32 UTC, Basile B. wrote:
> Hard breakage is not acceptable, even if the goal is to 
> introduce a more correct behavior.

I still wonder why module names are taken as a candidates for 
types and functions in the first place. Isn't there a symbol 
table for module names separate from that for type and function 
names?

Just checked how things are done in another language where 
modules are called “packages”:

```
// Foo.go
package Foo
import "fmt"

func Foo () {
    fmt.Println ("this is Foo.Foo ()");
}

// Soo.go
package Soo

type Soo struct {
    Name string
}

// main.go
package main
import "fmt"
import . "Foo"
import . "Soo"

func main () {
    fmt.Println ("main package")
    Foo ()
    s := Soo {Name: "xx"}
    fmt.Println (s.Name)
}
```

Besides the hard to remember syntax that only those symbols are 
exported which start with an uppercase letter it works as 
expected.


More information about the Digitalmars-d-learn mailing list