imports - 2 years later

Regan Heath regan at netwin.co.nz
Thu Mar 9 01:25:49 PST 2006


On Wed, 08 Mar 2006 21:39:34 +0000, Ant <duitoolkit at yahoo.ca> wrote:
> Regan Heath wrote:
>> On Wed, 08 Mar 2006 19:35:22 +0000, Ant <duitoolkit at yahoo.ca> wrote:
>>> Walter, we still have:
>>>
>>> gtk/TextBuffer.d(88): import gtk.TextBuffer.std conflicts with  
>>> gtk.TextChildAnchor.std at gtk/TextChildAnchor.d(46)
>>> gtk/TextBuffer.d(88): import gtk.TextBuffer.std conflicts with  
>>> gtk.TextChildAnchor.std at gtk/TextChildAnchor.d(46)
>>> gtk/TextBuffer.d(88): import gtk.TextBuffer.std conflicts with  
>>> gtk.TextChildAnchor.std at gtk/TextChildAnchor.d(46)
>>> gtk/TextBuffer.d(88): import gtk.TextBuffer.std conflicts with  
>>> gtk.TextChildAnchor.std at gtk/TextChildAnchor.d(46)
>>> gtk/TextBuffer.d(88): import gtk.TextBuffer.std conflicts with  
>>> gtk.TextChildAnchor.std at gtk/TextChildAnchor.d(46)
>>> gtk/TextBuffer.d(88): import gtk.TextBuffer.std conflicts with  
>>> gtk.TextChildAnchor.std at gtk/TextChildAnchor.d(46)
>>>
>>>
>>> these are both private import std.string;
>>>
>>> the interesting thing is that I had a
>>> private import std.c.stdio;
>>> in one module that would supply std.string to a bunch of other modules
>>>
>>> well, I know you cannot do anything about this
>>> and I know I cannot reduce this problem... but it's better than 2 year  
>>> ago! :)
>>  If you post the code here someone else might have a go at reducing it.
>>  Regan
>
> :) !
>
> linux 0.148 wait, let me grad 149... yep some with 149
>
> grab http://svn.dsource.org/projects/dui/trunk/src
>
> move the imports in src/gtk/TextBuffer.d to the module level
> 	private import std.stdarg;
> 	private import std.string;
>
> from the src dir compile the duitGtk lib with (change the absolute dirs  
> at the end):
>
> dmd gtk/AboutDialog.d gtk/AccelGroup.d gtk/AccelLabel.d gtk/AccelMap.d  
> gtk/Accessible.d gtk/Action.d gtk/ActionGroup.d gtk/Adjustment.d  
> gtk/Alignment.d gtk/Arrow.d gtk/AspectFrame.d gtk/Bin.d gtk/BindingSet.d  
> gtk/Box.d gtk/Button.d gtk/ButtonBox.d gtk/Calendar.d gtk/CellEditable.d  
> gtk/CellLayout.d gtk/CellRenderer.d gtk/CellRendererCombo.d  
> gtk/CellRendererPixbuf.d gtk/CellRendererProgress.d  
> gtk/CellRendererText.d gtk/CellRendererToggle.d gtk/CellView.d  
> gtk/CheckButton.d gtk/CheckMenuItem.d gtk/Clipboard.d gtk/ColorButton.d  
> gtk/ColorSelection.d gtk/ColorSelectionDialog.d gtk/ComboBox.d  
> gtk/ComboBoxEntry.d gtk/Container.d gtk/Curve.d gtk/Dialog.d  
> gtk/DragAndDrop.d gtk/DrawingArea.d gtk/Duit.d gtk/Editable.d  
> gtk/Entry.d gtk/EntryCompletion.d gtk/EventBox.d gtk/Expander.d  
> gtk/FileChooser.d gtk/FileChooserButton.d gtk/FileChooserDialog.d  
> gtk/FileChooserWidget.d gtk/FileFilter.d gtk/FileSelection.d gtk/Fixed.d  
> gtk/FontButton.d gtk/FontSelection.d gtk/FontSelectionDialog.d  
> gtk/Frame.d gtk/GCs.d gtk/GammaCurve.d gtk/HBox.d gtk/HButtonBox.d  
> gtk/HPaned.d gtk/HRuler.d gtk/HScale.d gtk/HScrollbar.d gtk/HSeparator.d  
> gtk/HandleBox.d gtk/IMContext.d gtk/IMContextSimple.d  
> gtk/IMMulticontext.d gtk/IconInfo.d gtk/IconSource.d gtk/IconTheme.d  
> gtk/IconView.d gtk/Idle.d gtk/Image.d gtk/ImageMenuItem.d  
> gtk/InputDialog.d gtk/Invisible.d gtk/Item.d gtk/ItemFactory.d  
> gtk/Label.d gtk/Layout.d gtk/ListStore.d gtk/MainWindow.d gtk/Menu.d  
> gtk/MenuBar.d gtk/MenuItem.d gtk/MenuShell.d gtk/MenuToolButton.d  
> gtk/MessageDialog.d gtk/Misc.d gtk/Notebook.d gtk/ObjectGtk.d  
> gtk/Paned.d gtk/Plug.d gtk/Progress.d gtk/ProgressBar.d  
> gtk/RadioAction.d gtk/RadioButton.d gtk/RadioMenuItem.d  
> gtk/RadioToolButton.d gtk/Range.d gtk/RcStyle.d gtk/Ruler.d gtk/Scale.d  
> gtk/Scrollbar.d gtk/ScrolledWindow.d gtk/Selections.d gtk/Separator.d  
> gtk/SeparatorMenuItem.d gtk/SeparatorToolItem.d gtk/Settings.d  
> gtk/Signals.d gtk/SizeGroup.d gtk/Socket.d gtk/SpinButton.d  
> gtk/StandardEnumerations.d gtk/Statusbar.d gtk/StockItem.d gtk/Style.d  
> gtk/Table.d gtk/TearoffMenuItem.d gtk/TextAttributes.d gtk/TextBuffer.d  
> gtk/TextChildAnchor.d gtk/TextIter.d gtk/TextMark.d gtk/TextTag.d  
> gtk/TextTagTable.d gtk/TextView.d gtk/Timeout.d gtk/ToggleAction.d  
> gtk/ToggleButton.d gtk/ToggleToolButton.d gtk/ToolButton.d  
> gtk/ToolItem.d gtk/Toolbar.d gtk/Tooltips.d gtk/TreeDragSource.d  
> gtk/TreeIter.d gtk/TreeModel.d gtk/TreeModelFilter.d gtk/TreeModelSort.d  
> gtk/TreeNode.d gtk/TreePath.d gtk/TreeRowReference.d gtk/TreeSelection.d  
> gtk/TreeSortable.d gtk/TreeStore.d gtk/TreeView.d gtk/TreeViewColumn.d  
> gtk/Types.d gtk/UIManager.d gtk/VBox.d gtk/VButtonBox.d gtk/VPaned.d  
> gtk/VRuler.d gtk/VScale.d gtk/VScrollbar.d gtk/VSeparator.d  
> gtk/Version.d gtk/Viewport.d gtk/Widget.d gtk/Window.d gtk/WindowGroup.d  
> gtk/typedefs.d  lib/Loader.d  lib/paths.d  lib/gtk.d  
> -I/home/ruimt/devel/D1/Duit/src:/home/ruimt/dmd/src/phobos:/home/ruimt/devel/D1/Duit/src:/home/ruimt/dmd/src/phobos  
> -c -gc -od/home/ruimt/devel/D1/Duit/obj/src -op
>
>
> wc src/*/*.d
> 165810  715148 5459708 total
>
> wc src/gtk/*.d
> 75926  312346 2279989 total
>
> but mostly comments
>
> This is a big problem for D that Walter chooses to attribute low  
> priority.

I believe Walter discourages the use of import inside a class and I  
believe your use of them is the reason for the problem.

For example, if you move all the imports within these 3 files to the  
module level:
   gobject/ObjectG.d
   gtk/TextBuffer.d
   gtk/TextChildAnchor.d

the errors vanish.. of course it results in different errors, most of  
which can be resolved by adding:
   private import std.string;

to the files which use std.string.toString.

Regan



More information about the Digitalmars-d-bugs mailing list