D - "from module import element"
- Jon Thoroddsen (23/23) Dec 04 2003 I propose that we should be able to import only part of the module symbo...
- J Anderson (11/35) Dec 04 2003 Just a syntax alternative:
- Matthew Wilson (13/63) Dec 04 2003 Either way is good. Maybe the second is slightly more amenable to wizard...
I propose that we should be able to import only part of the module symbols using the syntax from c.stdio import printf this makes things more explicit when we want just a little bit of the module anyway, easier to find the module that the symbol is from, and possibly a smaller executable. I also propose that when you do import module you can only access the symbols through the module namespace. ie yada = module.func() If you can't live with the typing, you can always make an alias. You could also use the "from .." syntax above. Why? Makes it easier for programmers to find the source of a (class, funciton, whatever) when maintaining code. This is all Pythonesque BTW. There was a thing in Python like this: from module import * which imported all the symbols from a module much like "import module" in D is now. This has now been deprecated, because even though it saved typing at the time, people found that it made maintenace much more difficult and rallied against it :-) This would also make it much easier for IDEs to take you directly to the source of some function, same as humans.
Dec 04 2003
Jon Thoroddsen wrote:I propose that we should be able to import only part of the module symbols using the syntax from c.stdio import printf this makes things more explicit when we want just a little bit of the module anyway, easier to find the module that the symbol is from, and possibly a smaller executable. I also propose that when you do import module you can only access the symbols through the module namespace. ie yada = module.func() If you can't live with the typing, you can always make an alias. You could also use the "from .." syntax above. Why? Makes it easier for programmers to find the source of a (class, funciton, whatever) when maintaining code. This is all Pythonesque BTW. There was a thing in Python like this: from module import * which imported all the symbols from a module much like "import module" in D is now. This has now been deprecated, because even though it saved typing at the time, people found that it made maintenace much more difficult and rallied against it :-) This would also make it much easier for IDEs to take you directly to the source of some function, same as humans.Just a syntax alternative: import c.stdio (printf, scanf); //I prefer this version or import c.stdio only (printf, scanf); or import c.stdio with (printf, scanf); or import c.stdio symbols (printf, scanf); A good compiler should be able to strip out the unnessary. It's may only be a namespace issue.
Dec 04 2003
Either way is good. Maybe the second is slightly more amenable to wizards and code instrumentation. We do need this facility, however it looks. "J Anderson" <REMOVEanderson badmama.com.au> wrote in message news:bqn6u5$545$1 digitaldaemon.com...Jon Thoroddsen wrote:symbols usingI propose that we should be able to import only part of the modulemodulethe syntax from c.stdio import printf this makes things more explicit when we want just a little bit of thecould alsoanyway, easier to find the module that the symbol is from, and possibly a smaller executable. I also propose that when you do import module you can only access the symbols through the module namespace. ie yada = module.func() If you can't live with the typing, you can always make an alias. Youfunciton,use the "from .." syntax above. Why? Makes it easier for programmers to find the source of a (class,D iswhatever) when maintaining code. This is all Pythonesque BTW. There was a thing in Python like this: from module import * which imported all the symbols from a module much like "import module" inthenow. This has now been deprecated, because even though it saved typing atralliedtime, people found that it made maintenace much more difficult andsourceagainst it :-) This would also make it much easier for IDEs to take you directly to theof some function, same as humans.Just a syntax alternative: import c.stdio (printf, scanf); //I prefer this version or import c.stdio only (printf, scanf); or import c.stdio with (printf, scanf); or import c.stdio symbols (printf, scanf); A good compiler should be able to strip out the unnessary. It's may only be a namespace issue.
Dec 04 2003