473,657 Members | 2,540 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 1082
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.myfuncti on

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

Robin S.
----------------------
"Rex the Strange" <ro********@wid getinc.comwrote in message
news:11******** **************@ a75g2000cwd.goo glegroups.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********@wid getinc.comschri eb:
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.myfuncti on

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

Robin S.
----------------------
"Rex the Strange" <ro********@wid getinc.comwrote in message
news:11******** **************@ a75g2000cwd.goo glegroups.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
2393
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
3854
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 = PyArray_FromDimsAndData(1, int*dim, PyArray_DOUBLE, char*buf); Users will get a Numeric Array object and can change its values (and actually change the underlying C array).
5
1784
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 or a Safari oddity (which if it is, any top-tips to fix it would be most welcome!). Objective: I want to have the meat of the viewport divided into 3 columns (a fixed margin (say 140px) and 2 scalable panes on the right each of which
43
2709
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 the other, an entire column is replaced. --------------------------------------------------------------------------------------- ''' An oddity in the behavior of lists of lists. Occurs under Python 2.4.3 (#69, Mar 29 2006, 17:35:34)
6
3464
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 testee.py without changing the code for testee.py. testee.py has a module in it that we want to mock in some tests and in others use the real module. /foo.py: (real module) class bar:
7
3050
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 having to hardcode this info to be passed to the error message class. I can get the stack trace using system.environment.stacktrace - but this is too much info. I just want to display the function/sub name where the error was generated and the...
3
1516
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) Select File | Open... 3) Choose my file, foo.py, opening it in a window. 4) From that window, I hit F5 to run the module. Within the program, the snippet where I use the csv module is below:
0
2153
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 that only means that the name is indeed available in the global scope.
7
922
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 the equivalent of modules in Java? Please correct me if I'm wrong: I saved my Python code under the file Wow.py Wow.py is now a module and I can use it in other Python code: import Wow
0
8425
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1736
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.