laserlight;11047467 wrote:"Including" something for a class makes sense to me: it reflects separation of core language and standard library, and there are after all pros and cons to having some kind of autoload mechanism. Enabling functionality (as in language features) in this way though, is unusual unless it is for things that are deprecated or experimental.
But then why not just "include" everything behind the scenes and have everything available? Why force the user to have to manually include different directives so he can get his work done? And furthermore, when I create a new .aspx file in my project, the corresponding .cs file has this at the top by default:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Everything requires System, so to me that would be "core", but then you have to include it every time you want to use the language, which seems silly to me. I guess I don't see much of a difference between "core" and "standard library".
I totally get the idea that someone else has created a custom module (or whatever you want to call it) and you have to include it manually to use it, but for stuff that (to me) should be available out of the box I don't see the benefit in having to include some directive at the top to make it available. Using the above example I wouldn't be able to use the ArrayList class. It wouldn't even be available in my autocomplete or syntax highlighting. It's as if VS doesn't know what ArrayList is. But as soon as I add using System.Collections, it does. The sytax magically highlights and all the annoying red squiggly lines in my IDE go away.
In PHP if I want to use DateTime, I don't have to include something at the top of my file.
Derokorian;11047469 wrote:AFAIK, the includes are for .NET framework functionality. Everything that makes C# a language is available, but if you want to use the framework you have to include what you want. This is no different than using require at the top of your script in PHP to include that one class from the Framework your using (IE ZF2, CI, Lithium, etc) when no autoloader is available (or allowed, my boss doesn't like autoloaders so we're have to explicitly require everything).
I'm not going to lie... I have (had) no idea that you can do C# without the .NET framework. I thought the two were more or less married, and that C# was a Microsoft "product" (sort of its variation of C) to be used within .NET and written in VS. I know you can write C# in other editors (though I always thought the support for syntax highlighting, autocomplete, etc. was subpar compared to VS).