February 25, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "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. |
February 26, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "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; |
February 26, 2002 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "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; > |
March 23, 2003 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "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 |
March 26, 2003 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "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. |
March 26, 2003 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | | > | > 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 |
March 26, 2003 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "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.d above > wouldn't work either. Yes, having a module with the same name as its subdirectory doesn't work. |
March 26, 2003 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote: > > "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. 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 |
March 26, 2003 Re: import packages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Helmut Leitner | "Helmut Leitner" <leitner@hls.via.at> wrote in message news:3E8170D8.4586F4F9@hls.via.at... > Walter wrote: > > > > "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. > > Does that mean that a "just import" module can act as > a replacement for a "central header" file? Yes. > As there a different way to import a whole library or > would such a module be the way to go? The latter. |
Copyright © 1999-2021 by the D Language Foundation