473,503 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Module Oddity

Hello all,

Traditionally I'm a Delphi and VB6 programmer and have recently started
working with VB.NET (which, I might add, I love, but that's beside the
point). Anyway, I was trying to make a catch-all library of routines
which I use commonly (I have one in Delphi and I was porting some of
the routines to VB.NET).

I was delighted to find out about modules - I love that a language
doesn't tie you to making everything an object - in my opinion oop is
good, but it isn't the be-all-to-end-all of programming as some people
might have you believe: not everything in programming (or the world for
that matter) is an object. Some things are processes. Ideal programming
is a combination of the two.

But I digress.

Anyway, I thought I'd make a class library - I called it stdlib (which
is the name I always use: short for "standard library") and inside it I
put two modules: constants and procedures.

Here's the oddity. When I include them into a new file, using the
Imports statement, I find that I type:

Imports stdlib.

And when I hit the dot (.) a popup dropdown list appears showing me all
of the elements contained in stdlib. Fair enough, but I see "constants"
which I can then specify and I see "procedures" which I can specify but
I also see all of the constants defined in "constants" and all of the
procedures defined in "procedures."

What's even more weird is that although I can see these in the list if
I just define

Imports stdlib

with no qualifier and try to use those constants and procedures I get
unknown element errors when attempting to compile. Why even show them
if I can't use them at that level? What other options do I have? I
could make a static class except that that could promote stupidity in
attempting to make instances of that class. I've tried defining a
namespace which has the effect I want except that I can only put types
in them, no constants or subroutines.

Any thoughts?

Jan 18 '07 #1
6 1071
Rex;

that was the most well-spoken remarks-- about loving modules-- LoL

you're going to make me chuckle for a long time on that one; I've been
trying to explain this to some friends for the longest time and they
'just dont get it'

I love it man.. PLEASE keep speaking the truth; I think that OOP is a
load of hogwash; all it does is slow down development and slow down
execution

I've heard that 80% of vb6 developers 'never built a single class'
and I agree with that diagnosis.

and it pisses me off that Microsoft is jamming OOP down our throats;
they're trying to sell us on features that we don't want or need.

I enjoy code re-use -- I'm a big fat lazy programmer-- so I use modules
almost exclusively

-Aaron

Jan 19 '07 #2
When you want to use one of the module's entries, try
prefixing it with "stdlib".

x = stdlib.myfunction

BTW, modules seem to have gone out of fashion, and
most people use classes now.

Robin S.
----------------------
"Rex the Strange" <ro********@widgetinc.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
Hello all,

Traditionally I'm a Delphi and VB6 programmer and have recently
started
working with VB.NET (which, I might add, I love, but that's beside the
point). Anyway, I was trying to make a catch-all library of routines
which I use commonly (I have one in Delphi and I was porting some of
the routines to VB.NET).

I was delighted to find out about modules - I love that a language
doesn't tie you to making everything an object - in my opinion oop is
good, but it isn't the be-all-to-end-all of programming as some people
might have you believe: not everything in programming (or the world
for
that matter) is an object. Some things are processes. Ideal
programming
is a combination of the two.

But I digress.

Anyway, I thought I'd make a class library - I called it stdlib (which
is the name I always use: short for "standard library") and inside it
I
put two modules: constants and procedures.

Here's the oddity. When I include them into a new file, using the
Imports statement, I find that I type:

Imports stdlib.

And when I hit the dot (.) a popup dropdown list appears showing me
all
of the elements contained in stdlib. Fair enough, but I see
"constants"
which I can then specify and I see "procedures" which I can specify
but
I also see all of the constants defined in "constants" and all of the
procedures defined in "procedures."

What's even more weird is that although I can see these in the list if
I just define

Imports stdlib

with no qualifier and try to use those constants and procedures I get
unknown element errors when attempting to compile. Why even show them
if I can't use them at that level? What other options do I have? I
could make a static class except that that could promote stupidity in
attempting to make instances of that class. I've tried defining a
namespace which has the effect I want except that I can only put types
in them, no constants or subroutines.

Any thoughts?

Jan 19 '07 #3
Rex the Strange wrote:
I was delighted to find out about modules - I love that a language
doesn't tie you to making everything an object
Guess What? Under the covers, Modules are Classes; they're just
Attribute'd in such a way that everything you put into one is implicitly
made "Shared" ... ;-)
in my opinion oop is good, but it isn't the be-all-to-end-all of
programming as some people might have you believe:
Agreed.
Anyway, I thought I'd make a class library - I called it stdlib (which
is the name I always use: short for "standard library") and inside it I
put two modules: constants and procedures.
You don't actually need the enclosing Class. Compare these:

Class stdlib
Module Constants
Module Procedures
End Class

Namespace ?.?.stdlib
Module Constants
Module Procedures
End Namespace
Here's the oddity. When I include them into a new file, using the
Imports statement, I find that I type:

Imports stdlib.

And when I hit the dot (.) a popup dropdown list appears showing me all
of the elements contained in stdlib.
Is this is the same Project in which you define stdlib?
If so, examine the Root namespace Project Property.

In all likelihood, this is set to "stdlib" and ,if it is, remove it!!

I've /never/ found a Good Reason to use this property and /lots/ of Good
Reasons to get rid of it, not least of which being that it messes up all
the References, prefixing them with, in your case, "stdlib."!

HTH,
Phill W.
Jan 19 '07 #4
"Rex the Strange" <ro********@widgetinc.comschrieb:
I was delighted to find out about modules - I love that a language
doesn't tie you to making everything an object - in my opinion oop is
good, but it isn't the be-all-to-end-all of programming as some people
might have you believe: not everything in programming (or the world for
that matter) is an object. Some things are processes. Ideal programming
is a combination of the two.

But I digress.

Anyway, I thought I'd make a class library - I called it stdlib (which
is the name I always use: short for "standard library") and inside it I
put two modules: constants and procedures.

Here's the oddity. When I include them into a new file, using the
Imports statement, I find that I type:

Imports stdlib.

And when I hit the dot (.) a popup dropdown list appears showing me all
of the elements contained in stdlib. Fair enough, but I see "constants"
which I can then specify and I see "procedures" which I can specify but
I also see all of the constants defined in "constants" and all of the
procedures defined in "procedures."
As all modules are imported automatically, all members defined in modules
can be used without qualifying them with the module name or namespace
containing the module. This behavior is by design.

To group types, use namespaces.
To group methods, use modules.
To represent entities, use classes.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 19 '07 #5
Interesting comments from all of you. I realize that modules are
classes under the covers (it's in the documentation that it is
essentially a class comprised entirely of static methods). It seems
people go both ways on the oop debate.

But really, there should be no debate. Do what works for you.

rts.

Jan 19 '07 #6
robin

guess what you're full of crap

80% of vb developers have never written a class

-Aaron
RobinS wrote:
When you want to use one of the module's entries, try
prefixing it with "stdlib".

x = stdlib.myfunction

BTW, modules seem to have gone out of fashion, and
most people use classes now.

Robin S.
----------------------
"Rex the Strange" <ro********@widgetinc.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
Hello all,

Traditionally I'm a Delphi and VB6 programmer and have recently
started
working with VB.NET (which, I might add, I love, but that's beside the
point). Anyway, I was trying to make a catch-all library of routines
which I use commonly (I have one in Delphi and I was porting some of
the routines to VB.NET).

I was delighted to find out about modules - I love that a language
doesn't tie you to making everything an object - in my opinion oop is
good, but it isn't the be-all-to-end-all of programming as some people
might have you believe: not everything in programming (or the world
for
that matter) is an object. Some things are processes. Ideal
programming
is a combination of the two.

But I digress.

Anyway, I thought I'd make a class library - I called it stdlib (which
is the name I always use: short for "standard library") and inside it
I
put two modules: constants and procedures.

Here's the oddity. When I include them into a new file, using the
Imports statement, I find that I type:

Imports stdlib.

And when I hit the dot (.) a popup dropdown list appears showing me
all
of the elements contained in stdlib. Fair enough, but I see
"constants"
which I can then specify and I see "procedures" which I can specify
but
I also see all of the constants defined in "constants" and all of the
procedures defined in "procedures."

What's even more weird is that although I can see these in the list if
I just define

Imports stdlib

with no qualifier and try to use those constants and procedures I get
unknown element errors when attempting to compile. Why even show them
if I can't use them at that level? What other options do I have? I
could make a static class except that that could promote stupidity in
attempting to make instances of that class. I've tried defining a
namespace which has the effect I want except that I can only put types
in them, no constants or subroutines.

Any thoughts?
Jan 19 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2378
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
8
3838
by: Bo Peng | last post by:
Dear list, I am writing a Python extension module that needs a way to expose pieces of a big C array to python. Currently, I am using NumPy like the following: PyObject* res =...
5
1775
by: jmdocherty | last post by:
All, I've been trying to set up a CSS layout and all seems well in Firefox but in Safari it just seems to be plain weird! I hope someone can help tell me whether this is a problem with my code...
43
2677
by: michael.f.ellis | last post by:
The following script puzzles me. It creates two nested lists that compare identically. After identical element assignments, the lists are different. In one case, a single element is replaced. In...
6
3451
by: Silfheed | last post by:
Heyas So we have the following situation: we have a testee.py that we want to automatically test out and verifiy that it is worthy of being deployed. We want our tester.py to test the code for...
7
3045
by: Brad Pears | last post by:
I am developing a simple error message class and would like the be able to generate as part of the message the curent class/module/form and function or sub that the error was generated in without...
3
1506
by: t_rectenwald | last post by:
I've noticed an oddity when running a program, using the csv module, within IDLE. I'm new to Python so am confused by what is happening. Here is what I'm doing: 1) Open the IDLE Shell. 2)...
0
2122
by: Fredrik Lundh | last post by:
Jeff Dyke wrote: so how did that processing use the "mymodulename" name? the calling method has nothing to do with what's considered to be a local variable in the method being called, so...
7
916
by: Hussein B | last post by:
Hi. I'm a Java guy and I'm playing around Python these days... In Java, we organize our classes into packages and then jarring the packages into JAR files. What are modules in Python? What is...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.