Forums

Event declarations and firing Events

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Re: Event declarations and firing Events

Postby Charles » Wed Aug 13, 2008 4:40 pm

I fixed the bug you reported above about the argless "init" not being found if "init" was overloaded.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Event declarations and firing Events

Postby Charles » Wed Aug 13, 2008 4:45 pm

I think Cobra should also allow an event decl in a single line like so:
class Button

event click(sender as Object, args as MyEventArgs)

# instead of:
sig ClickHandler(sender as Object, args as MyEventArgs)
event click as ClickHandler


And the "listen" statement should accept a method with more narrow arguments such as "sender as Button" instead of "sender as Object".

Both these ideas come straight out of Visual Basic. Their merit is convenience.

A further idea for consideration is the "handles" syntax from VB.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Event declarations and firing Events

Postby hopscc » Wed Aug 13, 2008 8:08 pm

Agree about the added convenience of the merged event+sig syntax.

The narrowed 'listen' args seems to already work providing the sig is in sync.
(is that what you mean - allowing the sig params to be more generic than (assignable from) the actual handler params ?

No opinion on the VB-like 'handles' syntax
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Previous

Return to Discussion

Who is online

Users browsing this forum: No registered users and 15 guests