Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Jonathan M Davis
On 2011-05-27 12:27, Jacob Carlborg wrote: > On 2011-05-27 16:38, Matthew Ong wrote: > > On 5/27/2011 9:37 PM, Jacob Carlborg wrote: > >> When coding my own projects (projects I've written from scratch and not > >> ported from other languages) it's a feature I rarely use, don't know if > >> I ever

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Jacob Carlborg
On 2011-05-27 16:38, Matthew Ong wrote: On 5/27/2011 9:37 PM, Jacob Carlborg wrote: On 2011-05-27 13:42, Matthew Ong wrote: On 5/27/2011 7:08 PM, Steven Schveighoffer wrote: Maybe you are not doing something correctly, you shouldn't need this feature all the time. Not me, others that has code

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Jacob Carlborg
On 2011-05-27 16:09, Steven Schveighoffer wrote: On Fri, 27 May 2011 09:43:39 -0400, Jacob Carlborg wrote: On 2011-05-27 14:08, Steven Schveighoffer wrote: I may see why you see so many cases -- dwt was likely ran through a java to d converter, and such converters often add unnecessary line

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Steven Schveighoffer
On Fri, 27 May 2011 13:25:51 -0400, Andrei Alexandrescu wrote: On 5/27/11 1:06 PM, Dejan Lekic wrote: A couple of years ago, Walter gave a talk on hijacking to NWCPP. It all went well until HiddenFunc, at which point Walter's assertion that the way out was by throwing an exception was hotly

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Andrei Alexandrescu
On 5/27/11 1:06 PM, Dejan Lekic wrote: A couple of years ago, Walter gave a talk on hijacking to NWCPP. It all went well until HiddenFunc, at which point Walter's assertion that the way out was by throwing an exception was hotly debated. Several people suggested alternative, of whom one proposed

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Matthew Ong
On 5/27/2011 10:10 PM, Andrei Alexandrescu wrote: On 5/27/11 1:34 AM, Matthew Ong wrote: Hi All, At least not using foo and bar, I am able to understand some of that is being discussed here. Thank you all. >2 is just annoying. For the sake of backward compatibility, keep that machination. Ho

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Dejan Lekic
A couple of years ago, Walter gave a talk on hijacking to NWCPP. It all went well until HiddenFunc, at which point Walter's assertion that the way out was by throwing an exception was hotly debated. Several people suggested alternative, of whom one proposed (4) above. Everybody agreed it's a good

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Andrei Alexandrescu
On 5/27/11 10:04 AM, Steven Schveighoffer wrote: On Fri, 27 May 2011 10:54:14 -0400, Andrei Alexandrescu wrote: It is completely against the spirit of the language to decide that a call is resolved to an invalid method during runtime. There is no other feature remotely related to hiddenfunc.

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Steven Schveighoffer
On Fri, 27 May 2011 10:54:14 -0400, Andrei Alexandrescu wrote: It is completely against the spirit of the language to decide that a call is resolved to an invalid method during runtime. There is no other feature remotely related to hiddenfunc. A couple of years ago, Walter gave a talk on

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Andrei Alexandrescu
On 5/27/11 9:26 AM, Steven Schveighoffer wrote: On Fri, 27 May 2011 10:10:25 -0400, Andrei Alexandrescu wrote: On 5/27/11 1:34 AM, Matthew Ong wrote: Hi All, Currently within D, to make use of a parent class method you have to do: class Parent{ void methodA(int x){...} } class Child : Paren

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Matthew Ong
On 5/27/2011 9:37 PM, Jacob Carlborg wrote: On 2011-05-27 13:42, Matthew Ong wrote: On 5/27/2011 7:08 PM, Steven Schveighoffer wrote: Maybe you are not doing something correctly, you shouldn't need this feature all the time. Not me, others that has coded the dwt and I suspect other code in dso

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Steven Schveighoffer
On Fri, 27 May 2011 10:10:25 -0400, Andrei Alexandrescu wrote: On 5/27/11 1:34 AM, Matthew Ong wrote: Hi All, Currently within D, to make use of a parent class method you have to do: class Parent{ void methodA(int x){...} } class Child : Parent{ // I understand that it has to do with preve

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Andrei Alexandrescu
On 5/27/11 1:34 AM, Matthew Ong wrote: Hi All, Currently within D, to make use of a parent class method you have to do: class Parent{ void methodA(int x){...} } class Child : Parent{ // I understand that it has to do with preventing accidental hijacking alias Parent.methodA methodA; void method

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Steven Schveighoffer
On Fri, 27 May 2011 09:43:39 -0400, Jacob Carlborg wrote: On 2011-05-27 14:08, Steven Schveighoffer wrote: I may see why you see so many cases -- dwt was likely ran through a java to d converter, and such converters often add unnecessary lines, because it is easier to do that than to examine

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Jacob Carlborg
On 2011-05-27 14:08, Steven Schveighoffer wrote: On Fri, 27 May 2011 07:42:17 -0400, Matthew Ong wrote: On 5/27/2011 7:08 PM, Steven Schveighoffer wrote: I don't think it will work that well. Consider how function hijacking happens. For instance, the parent class author may not even know his

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Jacob Carlborg
On 2011-05-27 13:42, Matthew Ong wrote: On 5/27/2011 7:08 PM, Steven Schveighoffer wrote: Do you have cases where you have to "alias all over the place"? news://news.digitalmars.com:119/iri4am$2dl3$1...@digitalmars.com http://hg.dsource.org/projects/dwt2/file/d00e8db0a568/base/src/java/io/ByteA

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Steven Schveighoffer
On Fri, 27 May 2011 08:36:08 -0400, Matthew Ong wrote: On 5/27/2011 8:08 PM, Steven Schveighoffer wrote: Sorry, I used the wrong term, I meant derived or extended. Explain please. You lost me. If I am not wrong, final is used to prevent overriding. Is that what you are talking about? No, I

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Matthew Ong
On 5/27/2011 8:08 PM, Steven Schveighoffer wrote: Sorry, I used the wrong term, I meant derived or extended. Explain please. You lost me. If I am not wrong, final is used to prevent overriding. Is that what you are talking about? Yes, but you marked the child as inheritall, doesn't this impli

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Steven Schveighoffer
On Fri, 27 May 2011 07:42:17 -0400, Matthew Ong wrote: On 5/27/2011 7:08 PM, Steven Schveighoffer wrote: I don't think it will work that well. Consider how function hijacking happens. For instance, the parent class author may not even know his code is being overridden, and he may simply not m

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Matthew Ong
On 5/27/2011 7:08 PM, Steven Schveighoffer wrote: On Fri, 27 May 2011 02:34:34 -0400, Matthew Ong wrote: Hi All, Currently within D, to make use of a parent class method you have to do: class Parent{ void methodA(int x){...} } class Child : Parent{ // I understand that it has to do with prev

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Steven Schveighoffer
On Fri, 27 May 2011 02:34:34 -0400, Matthew Ong wrote: Hi All, Currently within D, to make use of a parent class method you have to do: class Parent{ void methodA(int x){...} } class Child : Parent{ // I understand that it has to do with preventing accidental hijacking alias

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-27 Thread Matthew Ong
On 5/27/2011 2:54 PM, Jacob Carlborg wrote: Hi Jacob, See some of the source code shown here. I did not code them, but can sense the pattern is not too productive brain cycle invested. Cycle= trying to locate up the tree of inherited object. BTW, default D documentation is Not too friendly for

Re: Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-26 Thread Jacob Carlborg
On 2011-05-27 08:34, Matthew Ong wrote: Hi All, Currently within D, to make use of a parent class method you have to do: class Parent{ void methodA(int x){...} } class Child : Parent{ // I understand that it has to do with preventing accidental hijacking alias Parent.methodA methodA; void metho

Could new keyword help function hijacking and prevented aliasing all over the place??

2011-05-26 Thread Matthew Ong
Hi All, Currently within D, to make use of a parent class method you have to do: class Parent{ void methodA(int x){...} } class Child : Parent{ // I understand that it has to do with preventing accidental hijacking alias Parent.methodA methodA; void methodA(long x){...} } void ma