What is the proper or most appropriate language agnostic name for C#'s "using" and VB's "Imports"?
alias
namespace
include
reference
or something else?
I'd refer to this as a "module inclusion" feature.
I'm guessing package. You have the same in Java.
You can say you're using/importing a package. I'd say all the rest are quite different.
Related
I'm looking to create my own scripting language, highly based off of lua (im planning on it being lua but easier to understand for me) so I need to know where the predetermined functions / variables file is, because I would like to edit that. If you have a solution, please comment and let me know!
Every table in the standard library is defined in its own C file. In the src directory of the Lua source package, look for the file whose name is similar to the library name. Global functions are defined in lbaselib.c.
I have a question to ask regarding checkstyle.
It seems that the checkstyle api accepts both module name,
ConstantName and ConstantNameCheck (ConstantName with Check concatenated) for the configuration file, checkstyle.xml.
I would like to ask why is there a double standard here even though documentations on http://checkstyle.sourceforge.net/ only promotes ConstantName module and what is the difference between using either of them? Will either one of them gets deprecated in future?
Thanks!
Behind the scenes, the ConstantName check is implemented by a Java class called
com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck.
You could actually refer to the module in checkstyle.xml by this so-called "fully qualified" name. The other notations are shorthand offered by Checkstyle for convenience. ConstantNameCheck is the simple name of the implementing Java class, and ConstantName is still shorter. Checkstyle will try all three variants when looking for the module in your checkstyle.xml. So, there is no difference between these notations.
The recommended way is to use the most concise form, ConstantName, but as far as I know, none of the other forms is going to get deprecated any time soon.
In the autoconf manual, it is noted that
AC_INIT (package, version, [bug-report], [tarname], [url])
defines multiple macro names such as AC_PACKAGE_NAME and PACKAGE_NAME.
Running configure also generates a config file with definition like the following:
define HAVE_LIBGMP 1
As I am writing C++ code, I find these macros annoying yet useful. In fact, it happened many times that I needed to link with a library that uses the autotools and thus has these macros in its headers. So the situation is that there is conflict on headers macros such as:
define PACKAGE_NAME "library"
define PACKAGE_NAME "mine"
So, I was wondering if there was a way to tell the autotools to define at least some of these macros inside some kind of structure as follows:
`struct header_information{
static string package_name;
static bug_report;
....
}`
and then initialize it with the right macro names.
This solution would keep these informations encapsulated and does not pollute the global namespace ?
It seems to me like you want to abuse a package-private, build-system-ony configuration header file (config.h) that just so happens to define a convenient macro name that you'd like to use. I think the pretty obvious answer is "don't do that", or else you're on your own.
Unless I'm misunderstanding you?
Those defines are there so that the particular library can use them. It's not meant for other things to include. In fact, the majority of the things in config.h are completely useless outside of the particular package.
That doesn't mean that the library that config.h file belongs to couldn't provide what you're looking for, by defining a public struct in a header that uses those variables. Or perhaps a library that uses pkg-config (if you're just looking for package names) can provide some of information for you. But I don't think that autotools would or should provide that information to you.
I would like to do the following . I have declared a structure in my program and in run time when the program is being executed, if there is a user input, I should be able to create another new structure/edit that structure in my code. How can we do that? Is this what "A self modifying code"? Please clarify .Please give some examples .Thanks
Let me give an idea of what I wish to do , I have a "Structure/Class " called "student", which contains variables like "int roll_no" and "int reg_no". If the user wishes to add a new variable like "char name" in run time how can it be done?
Have a look on this:
http://bracha.org/Site/Talks.html
There is talk about reflection, which is probably what you want - reflection is not only about introspection (which most of developers already knows) but also about changing meaning of language constructs and runtime code manipulation.
Best languages for this kind of stuff are probably ruby and smalltalk.
If your language does not support these capabilities, you have still option to leverage code-generation - which is possible in almost every programming language but it is much easier in dynamic ones with "eval" support. For example this kind of stuff is possible even in C/C++ but your app has to embed compiler.
Java is good choice too (thx to classloaders and a lot of libraries for bytecode manipulation)
Oh, I've almost forgot, have a look on lisp and metacircular evaluation.
Sounds like you don't need to modify the existing code, but rather emit some new code in runtime. It is easy to do with any environment where your compiler is present in runtime. It is true for .NET, for JVM-based environments, various Lisps, etc.
I am following a VB tutorial to do some HTML manipulation using LINQ
It has the following construct
Imports <xmlns="http://www.w3.org/1999/xhtml">
How do I do the same in C#?
There appears to be something called an XMLNamespaceManager that may hold the solution, but I am too foolish to understand how to work it, and I am not sure it is the correct tree to bark up.
Got any advice?
VB.Net has a feature called XML Literals that is not present in C#. This import statement adds a namespace for use with those literals.
In researching this information, I found this link helpful:
http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx
It's also very informative for working with Excel xml docs, but that's a side issue ;)
I think the example you're looking at may be using XML literals, which are not supported in C#.