Re: Include Statement
- From: Mike <unknown@xxxxxxxxxx>
- Date: Tue, 05 May 2009 16:01:26 -0400
Herfried K. Wagner [MVP] wrote:
The VB compiler works in an other way than C/C++ compilers, for example.
Typically includes have been used in C/C++ to make functionality defined in another file available in another file (I do not use C/C++ terminology here because I am not sure if you are familiar with C/C++).
What terminology are you speaking of? I'm a veteran of 21+ different languages. VB.NET, C# and C++/CLR will be my 22, 23, 24. Use ANY references if you like.
This is done automatically by the VB compiler, so there is no need to do it manually.
Do what? IMO, you are limiting your mind to one way of doing things. A silly idea that "includes" are not useful is that same silly idea you said arrays are not useful in MOST cases.
If you are an MVP, you are suppose to be more open minded about general programming ideas.
Remember it is VB.NET that is learning from C/C++ concepts. If it can learn how to do inclusive increments,
string += string
and it learn compiler directives, it can also learn do a #include idea.
So why do other .NET, like C++ languages support a simple include concept? Including VB ASPX files?
The C++ compiler doesn't do all the work for you which the VB compiler does.
huh? Like what?
Also, lets distinguish VB.NET as oppose VB. Different animals.
ASP.NET applications differ in structure from the typical project which is compiled into one binary file.
What does that have to do with Include ideas?
I mean, this is yet another case where VB.NET attempts to inherit standard compiler concepts, but fails to do go all the way, only does for a few things. For example, existing compiler directive
#const USE_VERSION = 1
#if USE_VERSION = 1 then
some v1 code
#elseif USE_VERSION = 2 then
some v2 code
#else then
#error "USE_VERSION not defined"
#end if
Very powerful ideas for programmers. Don't tell me it "isn't necessary."
This is supported in VB.NET because it makes perfect sense even in VB.NET!
And this does not?
#const USE_VERSION = 1
#if USE_VERSION = 1 then
#include "version1.inc"
#elseif USE_VERSION = 2 then
#include "version2.inc"
#else then
#error "USE_VERSION not defined"
#end if
I already mentioned the reason why it is not necessary.
No, you did not.
In C/C++ '#include' is the typical way to make information from one file available to another one.
And why isn't that useful for VB.NET
> In C/C++ you even have to write forward
declarations
Hogwash. Not related at all.
and so on because the help the compiler provides in this regard is rather limited compared to the work the VB compiler does.
Man, and you are an MVP?
BTW, the '#include' concept of C/C++ is rather low-level and not very comfortable to use.
Again, outrageous statements.
namespace MyNewNameSpace
#include "class_dispose.vb"
#include "class_music.vb"
#include "class_whatever.vb"
end namespace
Just add the namespace declaration on each of the files.
What if I don't want to? But even then. Its besides the point.
No need to use text-based inclusion of other files. Code duplication, which was one of the top reasons for using '#include' in C/C++ isn't required and it would not work in VB.
But its ok for ASPX?
Code Duplication? How about library references? How about the idea of single sourcing?
You can have class files and a main
' file: class1.vb
class MyClass1
..
end class
' file: class2.vb
class MyClass2
..
end class
' file: main.vb
Module Module1
Sub Main()
End Sub
End Module
with no namespace requirements and compile it like
vbc main.vb class1.vb class2.vb
which is basically the same ideas of having:
#include "class1.vb"
#include "class2.vb"
Module Module1
Sub Main()
End Sub
End Module
Please, I think you mind is molded about GUI IDE development and now power programming console development methods. Its a side note, but the IDE does blind people of programming methods.
--
.
- Follow-Ups:
- Re: Include Statement
- From: Herfried K. Wagner [MVP]
- Re: Include Statement
- References:
- Include Statement
- From: Mike
- Re: Include Statement
- From: Herfried K. Wagner [MVP]
- Re: Include Statement
- From: Mike
- Re: Include Statement
- From: Herfried K. Wagner [MVP]
- Include Statement
- Prev by Date: Re: Include Statement
- Next by Date: Re: Include Statement
- Previous by thread: Re: Include Statement
- Next by thread: Re: Include Statement
- Index(es):
Relevant Pages
|