Thread overview
[D-runtime] What is a hidden function?
May 11, 2012
David Nadlinger
May 11, 2012
Sean Kelly
May 11, 2012
Hi,

I just noticed the onHiddenFuncError(Object o) function. However, I can't seem to figure out what on earth a hidden function is. Anyone know?

Regards,
Alex
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

May 11, 2012
On 11 May 2012, at 21:13, Alex Rønne Petersen wrote:
> I just noticed the onHiddenFuncError(Object o) function. However, I
> can't seem to figure out what on earth a hidden function is. Anyone
> know?

It occurs when for an overloaded member method which is only partially overridden in a subclass (without the other overloads being made available), a »hidden« overload is invoked on an instance of that subclass. Should (mostly?) be caught at compile time, though…

David
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

May 11, 2012
class A
{
   void hiddenFunction(int x);

}

class B : A

{
   void hiddenFunction(long x);  // does not override A.hiddenFunction!

}

B b = new B;
A a = b;

b.hiddenFunction(1); // ok, does not call A.hiddenFunction
a.hiddenFunction(1); // error, hiddenFunction exception thrown.

At least, this is what it used to mean.  I think Andrei wanted this to be a compile-time error, but I'm not sure if it is yet.

-Steve




>________________________________
> From: Alex Rønne Petersen <xtzgzorex@gmail.com>
>To: D's runtime library developers list <d-runtime@puremagic.com>
>Sent: Friday, May 11, 2012 3:13 PM
>Subject: [D-runtime] What is a hidden function?
> 
>Hi,
>
>I just noticed the onHiddenFuncError(Object o) function. However, I can't seem to figure out what on earth a hidden function is. Anyone know?
>
>Regards,
>Alex
>_______________________________________________
>D-runtime mailing list
>D-runtime@puremagic.com
>http://lists.puremagic.com/mailman/listinfo/d-runtime
>
>
>

May 11, 2012
Thanks for the replies.

I looked into the DMD sources, and it seems like it can still emit references to these functions, but doing so is deprecated. It will be a compile time error unless -d is passed.

Anyone know what Walter's policy is on removing deprecated features from DMD? Because this was deprecated in March, 2010. I honestly don't think keeping it around anymore makes sense.

Regards,
Alex

On Fri, May 11, 2012 at 9:13 PM, Alex Rønne Petersen <xtzgzorex@gmail.com> wrote:
> Hi,
>
> I just noticed the onHiddenFuncError(Object o) function. However, I can't seem to figure out what on earth a hidden function is. Anyone know?
>
> Regards,
> Alex
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

May 11, 2012
I think it should be a compile error, if possible.  But for complex class hierarchies, it may not be.  The idea came from MSVC, which default initializes vtbl entries to call a functionNotDefined routine that throws.  The alternative would be something fun like a bus error if this default method didn't exist.


On May 11, 2012, at 12:38 PM, Steve Schveighoffer wrote:

> class A
> {
>    void hiddenFunction(int x);
> }
> 
> class B : A
> {
>    void hiddenFunction(long x);  // does not override A.hiddenFunction!
> }
> 
> B b = new B;
> A a = b;
> 
> b.hiddenFunction(1); // ok, does not call A.hiddenFunction
> a.hiddenFunction(1); // error, hiddenFunction exception thrown.
> 
> At least, this is what it used to mean.  I think Andrei wanted this to be a compile-time error, but I'm not sure if it is yet.
> 
> -Steve
> 
> From: Alex Rønne Petersen <xtzgzorex@gmail.com>
> To: D's runtime library developers list <d-runtime@puremagic.com>
> Sent: Friday, May 11, 2012 3:13 PM
> Subject: [D-runtime] What is a hidden function?
> 
> Hi,
> 
> I just noticed the onHiddenFuncError(Object o) function. However, I can't seem to figure out what on earth a hidden function is. Anyone know?
> 
> Regards,
> Alex
> _______________________________________________
> D-runtime mailing list
> D-runtime@puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime
> 
> 
> _______________________________________________
> D-runtime mailing list
> D-runtime@puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime

_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

May 11, 2012
See: https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L826

Since these cases are statically disallowed entirely, I don't think we need anything in the runtime for it anymore.

Regards,
Alex

On Fri, May 11, 2012 at 11:47 PM, Sean Kelly <sean@invisibleduck.org> wrote:
> I think it should be a compile error, if possible.  But for complex class hierarchies, it may not be.  The idea came from MSVC, which default initializes vtbl entries to call a functionNotDefined routine that throws.  The alternative would be something fun like a bus error if this default method didn't exist.
>
>
> On May 11, 2012, at 12:38 PM, Steve Schveighoffer wrote:
>
>> class A
>> {
>>    void hiddenFunction(int x);
>> }
>>
>> class B : A
>> {
>>    void hiddenFunction(long x);  // does not override A.hiddenFunction!
>> }
>>
>> B b = new B;
>> A a = b;
>>
>> b.hiddenFunction(1); // ok, does not call A.hiddenFunction
>> a.hiddenFunction(1); // error, hiddenFunction exception thrown.
>>
>> At least, this is what it used to mean.  I think Andrei wanted this to be a compile-time error, but I'm not sure if it is yet.
>>
>> -Steve
>>
>> From: Alex Rønne Petersen <xtzgzorex@gmail.com>
>> To: D's runtime library developers list <d-runtime@puremagic.com>
>> Sent: Friday, May 11, 2012 3:13 PM
>> Subject: [D-runtime] What is a hidden function?
>>
>> Hi,
>>
>> I just noticed the onHiddenFuncError(Object o) function. However, I can't seem to figure out what on earth a hidden function is. Anyone know?
>>
>> Regards,
>> Alex
>> _______________________________________________
>> D-runtime mailing list
>> D-runtime@puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/d-runtime
>>
>>
>> _______________________________________________
>> D-runtime mailing list
>> D-runtime@puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/d-runtime
>
> _______________________________________________
> D-runtime mailing list
> D-runtime@puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime