D - import packages
- Pavel Minayev (9/9) Feb 24 2002 Is it possible to import the entire package, with all its subpackages
- Walter (3/12) Feb 24 2002 At the moment, no. I think it's better to explicitly list the ones impor...
- Pavel Minayev (8/9) Feb 24 2002 imported.
- Walter (4/13) Feb 24 2002 Whoever wrote that should then supply an import that simply imports all ...
- Pavel Minayev (4/6) Feb 24 2002 the
- Walter (3/9) Feb 24 2002 No, they'd have to have different names.
- Pavel Minayev (4/6) Feb 24 2002 Why? If you cannot import the package by its name anyhow,
- Walter (6/13) Feb 24 2002 I guess I'm not sure what you mean. Do you want to have this work:
- Pavel Minayev (4/8) Feb 25 2002 Absolutely. Since package foo is simply a directory "foo", and
- Walter (6/14) Feb 25 2002 But that would be analogous to:
- Pavel Minayev (4/8) Feb 25 2002 Then, we return back to the first post =)
- Walter (10/12) Feb 25 2002 file.d:
- Pavel Minayev (5/17) Feb 25 2002 ^^^^^^^^^^^^^^^^^^^^^^
-
Carlos Santander B.
(48/48)
Mar 22 2003
"Pavel Minayev"
escribiσ en el mensaje - Walter (4/46) Mar 25 2003 I thought it was clear - a 'package' can contain others simply by import...
- Carlos Santander B. (32/32) Mar 25 2003 | > | > file.d:
- Walter (6/22) Mar 25 2003 Yes, it would. But forgive me, I think that a module that needs to impor...
- Helmut Leitner (8/18) Mar 26 2003 Does that mean that a "just import" module can act as
- Walter (6/21) Mar 26 2003 imports.
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?
Feb 24 2002
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?
Feb 24 2002
"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 onesimported. 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)...
Feb 24 2002
"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...Whoever wrote that should then supply an import that simply imports all the other imports!At the moment, no. I think it's better to explicitly list the onesimported. 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)...
Feb 24 2002
"Walter" <walter digitalmars.com> wrote in message news:a5b95o$f0a$1 digitaldaemon.com...Whoever wrote that should then supply an import that simply imports alltheother imports!So it is legal to have both the package opengl and module opengl.d?
Feb 24 2002
"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...No, they'd have to have different names.Whoever wrote that should then supply an import that simply imports alltheother imports!So it is legal to have both the package opengl and module opengl.d?
Feb 24 2002
"Walter" <walter digitalmars.com> wrote in message news:a5bkgb$km2$1 digitaldaemon.com...Why? If you cannot import the package by its name anyhow, what's the problem with having a module with such a name?So it is legal to have both the package opengl and module opengl.d?No, they'd have to have different names.
Feb 24 2002
"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...I guess I'm not sure what you mean. Do you want to have this work: import foo; import foo.bar; ?Why? If you cannot import the package by its name anyhow, what's the problem with having a module with such a name?So it is legal to have both the package opengl and module opengl.d?No, they'd have to have different names.
Feb 24 2002
"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.
Feb 25 2002
"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...But that would be analogous to: struct foo { int bar; } int foo; foo.bar + foo;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.
Feb 25 2002
"Walter" <walter digitalmars.com> wrote in message news:a5drkl$1nbf$1 digitaldaemon.com...But that would be analogous to: struct foo { int bar; } int foo; foo.bar + foo;Then, we return back to the first post =) Some way to import the entire package by specifying its name.
Feb 25 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:a5dss1$1nri$1 digitaldaemon.com...Then, we return back to the first post =) Some way to import the entire package by specifying its name.file.d: ----- import foo; foo.d: ------ import bar; import silly; import abc;
Feb 25 2002
"Walter" <walter digitalmars.com> wrote in message news:a5eqea$268u$1 digitaldaemon.com..."Pavel Minayev" <evilone omen.ru> wrote in message news:a5dss1$1nri$1 digitaldaemon.com...^^^^^^^^^^^^^^^^^^^^^^ So if the package is named "foo", "import foo" would import all modules from it.Then, we return back to the first post =) Some way to import the entire package by specifying its name.file.d: ----- import foo; foo.d: ------ import bar; import silly; import abc;
Feb 25 2002
"Pavel Minayev" <evilone omen.ru> escribiσ en el mensaje 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? | | "Pavel Minayev" <evilone omen.ru> escribiσ en el mensaje news:a5f5b6$2aik$1 digitaldaemon.com... | "Walter" <walter digitalmars.com> wrote in message | news:a5eqea$268u$1 digitaldaemon.com... | > "Pavel Minayev" <evilone omen.ru> wrote in message | > news:a5dss1$1nri$1 digitaldaemon.com... | > > Then, we return back to the first post =) | > > Some way to import the entire package by specifying its name. | ^^^^^^^^^^^^^^^^^^^^^^ | | So if the package is named "foo", "import foo" would import all | modules from it. | | > file.d: | > ----- | > import foo; | > | > foo.d: | > ------ | > import bar; | > import silly; | > import abc; | > (I won't explain how I got to this) What happened to this? Walter, you never said anything about it. I'm thinking 'import foo.*;' could be a work-around for that. Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.463 / Virus Database: 262 - Release Date: 2003-03-17
Mar 22 2003
"Carlos Santander B." <carlos8294 msn.com> wrote in message news:b5k80a$11ia$1 digitaldaemon.com..."Pavel Minayev" <evilone omen.ru> escribiσ en el mensaje 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? | | "Pavel Minayev" <evilone omen.ru> escribiσ en el mensaje news:a5f5b6$2aik$1 digitaldaemon.com... | "Walter" <walter digitalmars.com> wrote in message | news:a5eqea$268u$1 digitaldaemon.com... | > "Pavel Minayev" <evilone omen.ru> wrote in message | > news:a5dss1$1nri$1 digitaldaemon.com... | > > Then, we return back to the first post =) | > > Some way to import the entire package by specifying its name. | ^^^^^^^^^^^^^^^^^^^^^^ | | So if the package is named "foo", "import foo" would import all | modules from it. | | > file.d: | > ----- | > import foo; | > | > foo.d: | > ------ | > import bar; | > import silly; | > import abc; | > (I won't explain how I got to this) What happened to this? Walter, you never said anything about it. I'm thinking 'import foo.*;' could be a work-around for that.I thought it was clear - a 'package' can contain others simply by importing them, a-la the foo.d above. An import of foo gets all of foo's imports.
Mar 25 2003
| > | > file.d: | > | > ----- | > | > import foo; | > | > | > | > foo.d: | > | > ------ | > | > import bar; | > | > import silly; | > | > import abc; | | I thought it was clear - a 'package' can contain others simply by importing | them, a-la the foo.d above. An import of foo gets all of foo's imports. I understand that, but what if module foo had a thousand files? Then foo.d would have a thousand import lines. I just tried this: \ |-e.d |-a\ |-a.d |-b.d |-c.d |-d.d a.d imports b,c and d. e.d imports a.a. If I do 'dmd -c e', I get: "Assertion failure: '0' on line 342 in file 'module.c'", so the foo.d above wouldn't work either. Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25
Mar 25 2003
"Carlos Santander B." <carlos8294 msn.com> wrote in message news:b5r0rg$2kec$1 digitaldaemon.com...| I thought it was clear - a 'package' can contain others simply by importing | them, a-la the foo.d above. An import of foo gets all of foo's imports. I understand that, but what if module foo had a thousand files? Then foo.d would have a thousand import lines.Yes, it would. But forgive me, I think that a module that needs to import a thousand other modules has more pressing problems <g>.I just tried this: \ |-e.d |-a\ |-a.d |-b.d |-c.d |-d.d a.d imports b,c and d. e.d imports a.a. If I do 'dmd -c e', I get: "Assertion failure: '0' on line 342 in file 'module.c'", so the foo.dabovewouldn't work either.Yes, having a module with the same name as its subdirectory doesn't work.
Mar 25 2003
Walter wrote:"Carlos Santander B." <carlos8294 msn.com> wrote in message news:b5r0rg$2kec$1 digitaldaemon.com...Does that mean that a "just import" module can act as a replacement for a "central header" file? As there a different way to import a whole library or would such a module be the way to go? -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com| I thought it was clear - a 'package' can contain others simply by importing | them, a-la the foo.d above. An import of foo gets all of foo's imports. I understand that, but what if module foo had a thousand files? Then foo.d would have a thousand import lines.Yes, it would.
Mar 26 2003
"Helmut Leitner" <leitner hls.via.at> wrote in message news:3E8170D8.4586F4F9 hls.via.at...Walter wrote:imports."Carlos Santander B." <carlos8294 msn.com> wrote in message news:b5r0rg$2kec$1 digitaldaemon.com...| I thought it was clear - a 'package' can contain others simply by importing | them, a-la the foo.d above. An import of foo gets all of foo'sfoo.dI understand that, but what if module foo had a thousand files? ThenYes.Does that mean that a "just import" module can act as a replacement for a "central header" file?would have a thousand import lines.Yes, it would.As there a different way to import a whole library or would such a module be the way to go?The latter.
Mar 26 2003