tag:blogger.com,1999:blog-3426506057708976304.post4822207483846989606..comments2011-04-14T16:54:02.709-07:00Comments on Codenoid: Anonymous Methods as Events in Delphilakeofcodehttp://www.blogger.com/profile/10666425420454133475noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-3426506057708976304.post-54235440927599772302011-04-14T16:54:02.709-07:002011-04-14T16:54:02.709-07:00Thanks for clarifications, Barry.
Yes, I was spec...Thanks for clarifications, Barry.<br /><br />Yes, I was speculating a little saying it would be trivial. Still a pretty nice feature to have.<br /><br />Regarding Self, sure it is important. But it points to wrong instance, so something like this:<br /><br /><b>Caption := 'Hello There!'</b><br /><br />will not work. That's why we look for Form instance via Owner.lakeofcodehttps://www.blogger.com/profile/10666425420454133475noreply@blogger.comtag:blogger.com,1999:blog-3426506057708976304.post-56468639350419908972011-04-13T04:33:38.806-07:002011-04-13T04:33:38.806-07:00The reason events (method pointers) were not chang...The reason events (method pointers) were not changed to method references is because it would be a huge change with massive backward compatibility ramifications, breaking our customers' code, reducing their incentive to upgrade, reducing our revenues, etc. In other words, it was not "an excuse" - it was the only responsible thing to do.<br /><br />If you really want to squeeze an anonymous method into a method pointer, I already wrote an article about it - http://blog.barrkel.com/2010/01/using-anonymous-methods-in-method.html<br /><br />The way you are currently doing it - typecasting to Cardinal - is ill advised with the move to 64-bit. Better to use a typecast to PByte instead, which supports pointer arithmetic.<br /><br />You're also wrong about Self not being important; Self and Sender serve two very different purposes. Sender references the control to which this particular triggering of the event relates; it is defined on the sending side. Self is provided by the subscriber of the event; it is defined on the receiving side. This division, between the sender of events and the receiver of events, cannot be simply split up, because it is normal for two different teams - often two different companies - to be responsible for each half of the code.Barry Kellyhttps://www.blogger.com/profile/10559947643606684495noreply@blogger.com