Re: Include Statement

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Mike" <unknown@xxxxxxxxxx> schrieb:
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 would not quote my post incompletely the answer to your question would already be included.

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.

Well, it could even learn inline assembler, couldn't it?

In programming language design the language designer makes a decision between different concepts which can be used to achieve a certain goal, based on an evaluation of these concepts. The '#include' concept is a rather low-level concept. Thus it's not present in many "younger" programming languages like Classic VB, Java, and .NET.

Interestingly the demand for this feature is practically non-existent, basically for the reason that there are now other ways to achieve the same goal as with the rather limited text-based '#include' approach.

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?

Re-read what I have written and you'll find the answer there. Hint: Looking for declarations. I really wonder if I'll see a thread here about re-introduction of forward declarations in the VB group, for the reason of adding well-known C/C++ concepts to VB. (BTW, I am aware that '#include' is used for additional purposes in C/C++).

Also, lets distinguish VB.NET as oppose VB. Different animals.

My terminology:

VB.NET = VB.
Classic VB = VB1 to VB6, VBA

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?

It was /you/ who mentioned ASPX files!

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

Could you show a real world sample?

I already mentioned the reason why it is not necessary.

No, you did not.

I did, but you didn't (want to?) read it.

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

Because it's not necessary, because it's done by the compiler. I already mentioned that.

> In C/C++ you even have to write forward
declarations

Hogwash. Not related at all.

Just quote what I wrote in context in future.

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?

Wow, that's a perfect technical argument, isn't it?

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.

It's the preferred way in VB. If you do not want to use VB, kindly use another programming language.

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?

I already said that ASP.NET uses a different compilation/execution model than project types which are compiled to a single binary.

Code Duplication? How about library references? How about the idea of single sourcing?

I was referring to C/C++. This would have been clear if you would have quoted me preserving the context.

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.

Most of the existing VB code is written in VS. Thus the language is optimized for a modern IDE. Nevertheless, as your first above sample demonstrated, it's even possible to get to the exact same result of what's shown in your second sample in VB, even by manually compiling via the command line compiler.

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

.



Relevant Pages

  • Re: C# without .net?
    ... C# is merely a programming language. ... language designed with .NET in mind, but there's no reason it can't be ... Just keep in mind that the framework would be ... Maybe a compiler other than that included in .NET SDK... ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is this a compiler error?
    ... we have no guarantee that the code is even valid Fortran at all. ... Those words don't even appear in the Fortran standard. ... |> meant in the context of a programming language. ... |> impractical for a compiler to do. ...
    (comp.lang.fortran)
  • Re: Dealing with ad hominem attacks in comp.programming
    ... Surely you use variables with impicit dimensions? ... It also determines whether you can use the programming language as is or need fiddles. ... If you have to live with existing ones, either use their notation or do a preprocessing stage to allow the use of your own. ... values in the machine and relying on the compiler to do units analysis. ...
    (comp.programming)
  • Re: Is this a compiler error?
    ... we have no guarantee that the code is even valid Fortran at all. ... Those words don't even appear in the Fortran standard. ... meant in the context of a programming language. ... impractical for a compiler to do. ...
    (comp.lang.fortran)
  • Re: How do we manage large code sets in PHP?
    ... A professional large project programming language? ... You start to use compiled PHP ... Source PHP compiler. ...
    (comp.lang.php)