Daniel - this thread is luckilly winding down, but I didn't want to leave
this reply completely hanging, so I'll address remaing stuff...
Daniel O'Connell said:
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.
IMHO, as well. I did not suggest (or didn't think I did) any such thing. I
suggested that they
could make use of nearly equally easy-to-use framework that would exist in a
system sans the event keyword, but possibly with other language mods in
place of "event", but supporting
the event model, as well as non-event code.
Basic eventing covers it very well without any pointless complications.
Agreed.
Obviously. You seem upset
No, I am not upset.
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.
I had no question, I just thought it was an interesting topic (current
"event" keyword vs. alternate event implementations) - perhaps it is not.
I guess I should have posted to comp-lang-csharp-random-musings...
It saves you no time because you clearly don't actually write them. Have
you ever written a class that *EXPOSES* events
Of course.
Yes, you have failed. You seem to be just shooting in the dark
against something you don't like.
Hey, I think you started shooting.
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.
Sorry - I should have been more clear. What I said was
"When I could have used 'event' as a notification
source" -- what I meant was
"When I could have used 'event' as a *general* notification
source *outside of the domain of GUI controls*". (A more general
publish/subscribe
scenerio.) All I was saying was I had to abandon the existing language
feature because
it was really close, but not extensible. A alternate event object
implementation could have been extended.
However, I agree that it's not a strong statement from the vantage point of
the existing "event" keyword
for me to say it wasn't useful for something that it wasn't designed for -
execpt that's not the vantage point I had.
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 would agree with you here in many cases.
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.
Yes, the anoymous class cruft gets pretty old - at least c# delgates hide
the
class definition from the user.
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.
I'm not sure I agree with that, exactly, as they are usually an integral
part
of the language from the start, so I'm not sure how the life-cycle
charaterization fits it. But macros can be both incredibly ugly and abused,
as well as extremely useful when they're needed. It's almost the opposite
life-cycle for marco's in the C-like languages -
they appeared first, and then many uses of macros (and typedef) are replaced
by the cleaner generics and/or templates, to the point where c# and Java
don't have macros them at all. (Although I still think Typedef would be nice
to have - even when
generics are a possible fit, you end up with recursive <T...> creep in all
your definitions. At least for
simple cases like defining the size of an integer that may need to change
from 16 to 32 bits, for example, I think typedef is a good fit.)
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 was thinking of common examples such as automatically wrapping public
members in possibly renamed
properties (e.g, for O/R mappers or data-binding controls that only look at
properties), providing proxy classes that provide an inplementation for an
interface that the object doesn't natively support, etc.
Again, not that it's the best way in an ideal world to accomplish the task,
it's just what's in the toolbox.
(As well as source-to-source transformation, a la Codesmith, etc.)
IMHO, both solutions have problems.
I don't think your method is necessarily the best either.
I never said it was the best.
Personally I
find it too complex with no added value.
It *is* more complex, but not from the subscriber's POV, which I think is
the important part.
The provider's implemetation can also be mostly pre-baked.
I presented some added value, but I'm okay with someone not agreeing that
the trade-off's are worth it.
thanks,
m