Sure -- which happens to be the way you implement functionality everywhere
else in the language.
Modifying add/remove behavior is not all that common AFAIKT, and if you
want more control you can just use delegates and your own notification
framework and forego events all-together. In the case of overriding
add/remove behavior, you're "burdening" the control/framework writer, not
the consumer/subscriber.
No, modifying add/remove behavior isn't very common, which is why the
add/remove accessors are pretty unknown. That doesn't really relate to
anything at all though. Your point here seems to be "if they want to control
add and remove, let them write their own framework" which is terrible, IMHO.
It's giving false credence to your model since it would only ever come up
with your model. Basic eventing covers it very well without any pointless
complications.
I think somehow we just violently agreed.
Obviously. You seem upset that something exists yet don't seem to mind a
complicated, multiclass solution that would have to follow as strenous a set
of rules and would have to be defined *IN THE SAME PLACE* to be as
effective, unless of course you are quite happy with a myriad of eventing
systems with slightly different semantics.
No. I don't beleive I said anything was "wrong" anywhere.
You seem to imply, deeply, that he current method is wrong...mainly because
you think so. I can't see why you bothered to post at all after your
question was answered if you didn't have an issue with the existing
implementation.
What, praytell, was that?
Again, no reasons. Are you going to give one?
It really saves me no time, as the collection classes have implemented
events the way they want, and I just use them.
An alternative need not impact me at all.
It saves you no time because you clearly don't actually write them. Have you
ever written a class that *EXPOSES* events or are you just talking strictly
from teh subscriber side here?
Then I really have failed, becuase the point was not to make a argument at
all.
Yes, you have failed. You seem to be just shooting in the dark agaisnt
something you don't like. You've given vitually no reasoning for it, just
complaints about it.
Says who? The only time I could have used "event" as a notification source
I could not, because it was lacking more control.
Wow. You've needed events *ONCE* and you couldn't use it, so it must be bad
eh? I'm sorry, you really don't seem to have used them enough to even have a
leg to stand on here, no offense intended.
Luckily, one can happily ignore "event" and use the underlying delegates -
so I have on complaints on my ability to acheive my goals with C#.
However, when one can ignore something in a language and do something that
is more general without *much* cost, it's valid to ask if it should be in
the language.
Sure. But was your general solution of use to anyone but you? Were you even
considering events properly? They are a very simple system that works the
vast majority of the time with absolutly no fuss. You hit one issue, the
only time you felt you need to use events, so they must have been done
wrong?
There is definatly more to it than generality, its what is most useful. The
complicated, general solution isn't always the right one, infact it's
probably the wrong one. Simple and static is almost always better than
complicated and general.
I'm not saying "event" was wrong, but certainly the lack of "event" is not
in the same league as the lack that other languages features would be - a
gaping hole. Basically, "event" is a very useful second "layer" of
language on top of C# -- as C# does not have macros, a meta-programming
model, or other mechanism for "layering", some features from this "base+1"
language layer will natually become part of the language. (Another example
includes Mozart, which has in interesting layered approach to language
design, adding mutability on top of a functional languages with "slots",
and then adding OO on top of this layer.) The use of Reflection.Emit (and
the new, lightweight versions) is another example -- and although done at
runtime by necessity, many uses of Emit are done on information that is
all present at compile-time, such as using reflection to inspect types
that were known at compile-time and to automatically generate concrete
implementations for certain interfaces.
I disagree with your first conclusion. That is my #2 complaint with Java, it
lacks first class events and makes up for it with a hackneyed, difficult to
follow system(especially when anonymous classes are involved.) The only
thing worse is the lack of first class properties.
Macro's and meta-programming is something I hope the language never has.
That is almost always the first sign that the language has outgrown its
value. And your uses of reflection don't really apply to much I've done
personally. I don't see the point in inspecting something I knew about
already.
I wasn't trying to say would they *shouldn't* be, I was saying why they
"needn't have been".
Sure, you've said why they needn't have been: because you have a different
solution. But that isn't a good answer. There are always other solutions,
unless you can show benefit, you didn't prove anything.
You don't really beleive your own slippery slope argument, so why present
the hyperbole?
Most of your litany of features is either completly impossible to
emulate/replace, or only possible at very great cost.
"event" is not in this category, which is the whole point.
Because I don't know if you actually believe yourself or not either. Almost
everything can be implemented in code, some languages even push it, it is
quite certainly possible to emulate any of these, its all a matter of cost
as you point out. While event is fairly cheap, that doesn't mean that it
shouldn't be moved up into the central language(and, as an argument I never
did make, events are a core part of the concept of a "component" that is a
big piece of the philosophy behind the language.) You have to have either a
technical or philosophical reason for it, merely that it's possible to do
without seems weak to me. Hyperbole, if you will.
A quick google on the topic has shown otherwise; although I agree I
searched for what I was looking for -- I'm not saying it's a feeling that
most c# programmers hold. Most people wouldn't give them a second
thought - I decsion that I now highly praise them for
What did you search for exactly? I see a number of articles on the
difference between delegates and events, but nothing else.
No, I don't -- they just not necessarily the "best" idea, given your
personal view of optimality. Given the same choice to make, I probably
could have been conviced to include the keywork as well.
I don't think your method is necessarily the best either. Personally I find
it too complex with no added value.