Thread overview | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 24, 2002 import packages | ||||
---|---|---|---|---|
| ||||
Is it possible to import the entire package, with all its subpackages and modules? The following doesn't work (yet?): import c; // stdio & stdlib int main() { printf("Hello, world!\n"); return 0; } Are you planning to support this feature? |
February 24, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | At the moment, no. I think it's better to explicitly list the ones imported. "Pavel Minayev" <evilone@omen.ru> wrote in message news:a5ai6p$4q8$1@digitaldaemon.com... > Is it possible to import the entire package, with all its subpackages and modules? The following doesn't work (yet?): > > import c; // stdio & stdlib > > int main() > { > printf("Hello, world!\n"); > return 0; > } > > Are you planning to support this feature? > > |
February 24, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a5aogs$7df$1@digitaldaemon.com... > At the moment, no. I think it's better to explicitly list the ones imported. Not really. Suppose an opengl package with modules like gl, glu and glut. Rather than importing them all one by one, a simple "import opengl" would do the job... and imagine the package with 20-30 modules (a huge GUI library, or a DB toolkit might be such)... |
February 24, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:a5avc3$akd$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a5aogs$7df$1@digitaldaemon.com... > > > At the moment, no. I think it's better to explicitly list the ones > imported. > > Not really. Suppose an opengl package with modules like gl, glu and glut. Rather than importing them all one by one, a simple "import opengl" would do the job... and imagine the package with 20-30 modules (a huge GUI library, or a DB toolkit might be such)... Whoever wrote that should then supply an import that simply imports all the other imports! |
February 24, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a5b95o$f0a$1@digitaldaemon.com... > Whoever wrote that should then supply an import that simply imports all the > other imports! So it is legal to have both the package opengl and module opengl.d? |
February 24, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:a5bbmc$g9m$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a5b95o$f0a$1@digitaldaemon.com... > > > Whoever wrote that should then supply an import that simply imports all > the > > other imports! > > So it is legal to have both the package opengl and module opengl.d? No, they'd have to have different names. |
February 25, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a5bkgb$km2$1@digitaldaemon.com... > > So it is legal to have both the package opengl and module opengl.d? > > No, they'd have to have different names. Why? If you cannot import the package by its name anyhow, what's the problem with having a module with such a name? |
February 25, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:a5cg4p$10qg$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a5bkgb$km2$1@digitaldaemon.com... > > > > So it is legal to have both the package opengl and module opengl.d? > > > > No, they'd have to have different names. > > Why? If you cannot import the package by its name anyhow, what's the problem with having a module with such a name? I guess I'm not sure what you mean. Do you want to have this work: import foo; import foo.bar; ? |
February 25, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a5cp04$15bt$1@digitaldaemon.com... > I guess I'm not sure what you mean. Do you want to have this work: > > import foo; > import foo.bar; > > ? Absolutely. Since package foo is simply a directory "foo", and module foo is a file "foo.d", it should work just fine. |
February 25, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:a5d1ti$1b0j$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:a5cp04$15bt$1@digitaldaemon.com... > > I guess I'm not sure what you mean. Do you want to have this work: > > import foo; > > import foo.bar; > > ? > Absolutely. Since package foo is simply a directory "foo", and module foo is a file "foo.d", it should work just fine. But that would be analogous to: struct foo { int bar; } int foo; foo.bar + foo; |
Copyright © 1999-2021 by the D Language Foundation