the name/description would be "Option Base 0 is redundant", and the meta would be "Option Base 0 is the default setting and does not need to be specified."
@IvenBach No you can't, but you can use a factory method - For example - You can't call the constructor on a Workbook (Set x = New Workbook won't compile because the ctor is unreachable), you have to use the factory method Set x = Workbooks.Add(...)
@IvenBach You can't create a new Workbook yourself, you have to ask Excel's Workbooks collection to add it for you. So Workbooks is the "Factory", and its Add method is the factory's method for creating a new Workbook. You, as a VBA programmer, and a consumer of the Workbooks object, can ask Workbooks to create a new instance of a workbook for you, and you provide arguments to Workbooks.Add that Workbooks will use to create the Workbook to your requirements.
Like a lot of stuff in VBA, you can't have a ctor with arguments because of COM restrictions. Classes are new'd up using Windows APIs - take a look at IClassFactory interface.
Factories and Factory Methods allow the factory to determine the initial state of new class instances according to the method arguments, so that consumers of the class don't need to create a new object and then configure it before use. Eg. Workbooks.Open` is a factory method for creating a new workbook based on an existing file (and all of the overhead that goes on for doing that behind the scenes)...
while Workbooks.Add is a factory method for creating a new workbook based on an optional template (and all of the overhead that goes on for doing that behind the scenes.)
Imagine if you created a Workbook with Set x = New Workbook, YOU would then be responsible for determining how many worksheets are created by default, whether the file is loaded from an existing file, or from an existing template, and a bunch of other things that Excel's Object Model doesn't trust you to get right.
@ThunderFrame I still don't fully understand. It's going to take more reading on my part until it 'clicks'. I've read many factory examples but it still hasn't come together for me, yet.
@IvenBach "Hey Mr. Workbooks (aka Ye Olde Factory for creating new Workbook instances), you won't let me use Set x = New Workbook, so can I please use your Open method for requesting a new workbook, if I tell you it already exists at "C:\Temp\Foo.xlsm"? Just make the damn thing already, and give it back to me all ready to go, and if I gave you the incorrect path, feel free to throw your toys out of the pram an error (and don't return anything)."
@ThunderFrame I'm a bit slow on the uptake... It's going to be a this is so easy moments once I understand it. I'll get there eventually. Not for lack of reading or other people explaining it to me.
yeah. I'd have been ready earlier, but my headphones crapped out on me a week ago, and it seems they're not going to honor the warranty, so I was doing some shopping. Plus I've been playing with different run trackers, because... different
is the migration to 2015 now recommended, necessary, optional, or at your discretion?
yes, community. Is there an in VS update or do I hit up MS? if MS, is there an update or just vs2015 community & it figures out that I only need to update, not full install...
I upgraded an old PC to VS2015 Community (keeping VS2013 Pro in place) - Delpending on which options you choose, the update is usually fast, but I picked pretty much a complete install and it took 12 hours)
@ThunderFrame I added a couple of options. And it's currently "Acquiring" Visual C++ Library so that musta been the option I picked. It's not exactly zipping along, but, then, my connection tests really fast, but in real life use seems pretty darn slow.
I can pass the rewriter instance to everything that needs to modify a module, and then GetText when I've removed/added/whatever all the tokens I needed to play with.. and dump it in a module
------ Discover test started ------
========== Discover test finished: 1694 found (0:00:03.0318848) ==========
------ Run test started ------
========== Run test finished: 1731 run (0:03:06.9860144) ==========
struct Rectangle
{
private int m_width;
public int Width
{
get
{
return m_width;
}
set
{
m_width = value;
}
}
private int m_height;
public int Height
{
get
{
return m_height;
}
set
{
m_height = value;
}
}
}
so a struct would be good for defining Window.TitleBarColor, Window.BackgroundColor, Window.TextColor, etc. they get set, maybe at build time, or once during loading, then they're read only from then on.
You can even overlay other views in the same struct:
[StructLayout(LayoutKind.Explicit)]
struct DWord
{
[FieldOffset(0)]
public uint Number;
[FieldOffset(0)]
public ushort LowWord;
[FieldOffset(0)]
public byte ByteOne;
[FieldOffset(1)]
public byte ByteTwo;
[FieldOffset(2)]
public ushort HighWord;
[FieldOffset(2)]
public byte ByteThree;
[FieldOffset(3)]
public byte ByteFour;
}
Because interfaces must be implemented by derived classes and structs, they define a contract. For instance, if class foo implements theIDisposable interface, it is making a statement that it guarantees it has the Dispose() method, which is the only member of the IDisposableinterface.
This I don't:
Any code that wishes to use class foo may check to see if class foo implements IDisposable. When the answer is true, then the code knows that it can call foo.Dispose().
if the interface is a contract that anything that implements it will have all the given pieces, why is it necessary for code to check to see if class foo implements IDisposable? if foo is an IDisposable, it'll have .Dispose() or it won't compile, right?
@Mat'sMug then I don't understand why I would have to test for the existence of .Dispose() if I know I'm working with an IDisposable. I shouldn't be getting an IRepository...
@FreeMan you generally don't have to, because if you have to know that, then you're the one who instantiated the concrete disposable type anyway, so you already know
Substitutability is a principle in object-oriented programming stating that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of T (correctness, task performed, etc.). More formally, the Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called (strong) behavioral subtyping, that was initially introduced by Barbara Liskov in a 1987 conference keynote address titled Data abstraction...
> Since the operations are done lazily at getText()-time, operations do not screw up the token index values. That is, an insert operation at token index i does not change the index values for tokens i+1..n-1.
I know - but what I'm looking at now is the perfect storm: something that can manipulate tokens at will, and something that knows everything about the target declaration and its context
I'm going to leave a bunch of debug output in my next commit.
I'm curious what the shutdown sequence looks like for those of you who can exit cleanly...
I'm also leaving in a ton of commented Dispose code in case it turns out to not improve the stability of the parser. I'll clean it out when I'm sure it can go.