473,563 Members | 2,856 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Option Explicit

Please, Microsoft, update Option Explicit

Option Strict barks at late binding. We love late
binding. So Option Strict flags too many things.

Option Explicit is misleading.
It allows
Dim LastName

rather than forcing
Dim LastName as string

Option Explicit should force the data type.
Option Explicit should also force functions to be
delared with a return data type.

The reason I'm harping is I just reviewed a Jr programmers
code and the code was full of Dim variables without data
types.

Nov 20 '05 #1
12 2064
I agree that Option Explicit should enforce a data type.

While late binding is convenient it is extremely inefficient, so while
Option Strict = On (by the way, notice that MS defaults this to Off) is more
of a pain, you wind up with less opportunity for type mismatches and better
performance.

IMHO :)

"Doug Hill" <an*******@disc ussions.microso ft.com> wrote in message
news:2b******** *************** ******@phx.gbl. ..
Please, Microsoft, update Option Explicit

Option Strict barks at late binding. We love late
binding. So Option Strict flags too many things.

Option Explicit is misleading.
It allows
Dim LastName

rather than forcing
Dim LastName as string

Option Explicit should force the data type.
Option Explicit should also force functions to be
delared with a return data type.

The reason I'm harping is I just reviewed a Jr programmers
code and the code was full of Dim variables without data
types.

Nov 20 '05 #2
Doug,
It seems your request is at odds with itself! :-)

Option Explicit On requires you to define the variable:
Dim LastName
Option Strict Off is allowing (defaults) that variable or function to be an
Object, as you are allowed to use late binding on it.
Dim LastName As Object
Personally the behavior makes sense.

Are you asking you want the compiler to force you to include the 'As Object'
so you can do the late binding?

You could use the MS Wish site to submit your suggestion to MS.

http://register.microsoft.com/mswish...=EN-US&gssnb=1

Generally I avoid Late Binding as it is far too easy to introduce far too
many runtime bugs. When I do need to use Late Binding I isolate it in one or
two modules in a far corner of my application.

However having the option is nice!

Have you looked at getting a Code Critic or Code Analyzer that your Jr
Programmers can run on the code to identify variables that are implicitly
defined as Object?

http://www.fmsinc.com/dotnet/analyzer/

Note I have not actually used the above, I just see value of Code Critics.
For just what you are asking.

Hope this helps
Jay

"Doug Hill" <an*******@disc ussions.microso ft.com> wrote in message
news:2b******** *************** ******@phx.gbl. .. Please, Microsoft, update Option Explicit

Option Strict barks at late binding. We love late
binding. So Option Strict flags too many things.

Option Explicit is misleading.
It allows
Dim LastName

rather than forcing
Dim LastName as string

Option Explicit should force the data type.
Option Explicit should also force functions to be
delared with a return data type.

The reason I'm harping is I just reviewed a Jr programmers
code and the code was full of Dim variables without data
types.

Nov 20 '05 #3
Thank you Jay and Scott
-----Original Message-----
Doug,
It seems your request is at odds with itself! :-)

Option Explicit On requires you to define the variable:
Dim LastName
Option Strict Off is allowing (defaults) that variable or

function to be anObject, as you are allowed to use late binding on it.
Dim LastName As Object
Personally the behavior makes sense.

Are you asking you want the compiler to force you to

include the 'As Object'so you can do the late binding?

You could use the MS Wish site to submit your suggestion to MS.
http://register.microsoft.com/mswish/suggestion.asp? &SD=GN&LN=EN-US&gssnb=1
Generally I avoid Late Binding as it is far too easy to introduce far toomany runtime bugs. When I do need to use Late Binding I isolate it in one ortwo modules in a far corner of my application.

However having the option is nice!

Have you looked at getting a Code Critic or Code Analyzer that your JrProgrammers can run on the code to identify variables that are implicitlydefined as Object?

http://www.fmsinc.com/dotnet/analyzer/

Note I have not actually used the above, I just see value of Code Critics.For just what you are asking.

Hope this helps
Jay

"Doug Hill" <an*******@disc ussions.microso ft.com> wrote in messagenews:2b******* *************** *******@phx.gbl ...
Please, Microsoft, update Option Explicit

Option Strict barks at late binding. We love late
binding. So Option Strict flags too many things.

Option Explicit is misleading.
It allows
Dim LastName

rather than forcing
Dim LastName as string

Option Explicit should force the data type.
Option Explicit should also force functions to be
delared with a return data type.

The reason I'm harping is I just reviewed a Jr programmers code and the code was full of Dim variables without data
types.

.

Nov 20 '05 #4
"Doug Hill" <an*******@disc ussions.microso ft.com> wrote in
news:2b******** *************** ******@phx.gbl:
Option Explicit should force the data type.
Option Explicit should also force functions to be
delared with a return data type.

The reason I'm harping is I just reviewed a Jr programmers
code and the code was full of Dim variables without data
types.


While I agreee that this would be useful, In the meantime, your Jr
programmers should follow best coding practices. They need to be educated.
Perhaps you could create a "coding standards" document and require them to
follow it.

Just a thought,

Chris
Nov 20 '05 #5
* "Doug Hill" <an*******@disc ussions.microso ft.com> scripsit:
Please, Microsoft, update Option Explicit

Option Strict barks at late binding. We love late
binding. So Option Strict flags too many things.

Option Explicit is misleading.
It allows
Dim LastName

rather than forcing
Dim LastName as string

Option Explicit should force the data type.
Option Explicit should also force functions to be
delared with a return data type.

The reason I'm harping is I just reviewed a Jr programmers
code and the code was full of Dim variables without data
types.


I would like 'Option Strict Off' blocks:

\\\
..
..
..
Option Strict Off
Nov 20 '05 #6
Hi Herfried,

We'll get them, sort of, in the next release - Partial Types. (But a bit
silly if your O.S.Off block is only a few lines long).

Regards,
Fergus
Nov 20 '05 #7

"Doug Hill" <an*******@disc ussions.microso ft.com> wrote in message
news:2b******** *************** ******@phx.gbl. ..
The reason I'm harping is I just reviewed a Jr programmers
code and the code was full of Dim variables without data
types.

I guess i would consider myself a "junior programmer", however, I would not be allowed to get away
with this. This is something that is BASIC programming practice. This sounds more like an
employee management issue than an option explicit not functioning correctly issue.

Nov 20 '05 #8
* "Fergus Cooney" <fi******@tesco .net> scripsit:
We'll get them, sort of, in the next release - Partial Types. (But a bit
AFAIk partial types will only be available in C#.
silly if your O.S.Off block is only a few lines long).


I think that's the big advantage of these blocks.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #9
Rick and Chris,
You are absolutely right. I couldn't believe a programmer
would not type variables, and I couldn't believe the tool
let them.
In talking with my bosses I mentioned that I have probably
50 rules that I always follow. Now they want me to
document them. ;-)
Thanks

-----Original Message-----
Please, Microsoft, update Option Explicit

Option Strict barks at late binding. We love late
binding. So Option Strict flags too many things.

Option Explicit is misleading.
It allows
Dim LastName

rather than forcing
Dim LastName as string

Option Explicit should force the data type.
Option Explicit should also force functions to be
delared with a return data type.

The reason I'm harping is I just reviewed a Jr programmerscode and the code was full of Dim variables without data
types.

.

Nov 20 '05 #10

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

Similar topics

8
12227
by: biro man | last post by:
I have a dynamic database driven page that I have been working on and tweaking etc until I have got it to work pretty much the way I want it to. I also have a defined website. I wish to include the new dbase page in the exisiting website and keep the "feel" of the exisiting website. So I thought the easiest way to do this wasy to use the...
1
2510
by: Robert Mark Bram | last post by:
Hi All! I have the following in a vb script: option explicit Response.Expires = -1 Server.ScriptTimeout = 600 The script gets imported in the following way: <script language="VBscript" runat=server src="lib/upload/aspUpload.asp">
7
3380
by: Mats | last post by:
Option Explicit does not work anymore.(?) If you put <%option explicit%> at the top of your pages (direktly after the language declaration) you should get an error for each undeclared variable. This does not happen, but undeclare variables lead to some odd results. Error somewhere or has IIS changfed its behavior? "Testbed" Win XP Pro SP2
5
2024
by: ken | last post by:
hi All What does this command dot Option Explicit
6
1567
by: Brett | last post by:
I find there is more casting required in C# than VB.NET. If Option Strict/Explicit is turned on, will this basically create the same environment as C# - uppercase, more casting required, must build event handlers? Thanks, Brett
9
2314
by: YYZ | last post by:
After reading many messages in this group, it seems that the preferred setting for this is ON. Okay, I did that in my project (first with ..Net -- long time VB6 developer) and now a bunch of problems have cropped up. Most are easy to solve with using an explicit type cast cType(whatever, whatever type), but some aren't. Situation 1: I've...
6
8987
by: John Kotuby | last post by:
Hi all, I am simply trying to include the Option Explicit declaration at the top of an ASP page and am getting an error: Error Type: Microsoft VBScript compilation (0x800A0400) Expected statement /transferkey.asp, line 2
0
1322
by: Michael Jenck | last post by:
Hi All, I have been playing with the codedom and can't get it to output for option compare Binary with a CodeCompileUnit. I have searched the web and Don't now if it's possible. If it's not possible I just go with CodeSnippetCompileUnit Please email me a copy at: programmer @ jenck . net (remove the extra spaces)
1
2134
by: Jimmbo | last post by:
I get an option explicit error saying it does not appear as the first line whenever I use it with utf-8 charset encoding on my Sun Cobalt server running Chillisoft on Linux. The error does not occur if the charset declaration in the metatag is 8859-1 but this causes spurious characters such as capital A with a circle over it to appear before...
0
7665
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...
0
7583
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...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7642
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...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
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...
1
2082
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
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.