August 06, 2005
This line is taken from mango:

typedef get opCall;

Does above line create a new function named "opCall" ? or is "opCall" just another name for existing function "get" ?

I thought typedef works only for data types, but here it seems to work on functions too.

Could someone please point me the documentation page for this usage.

Thanks in advance
Sai



August 07, 2005
sai wrote:
> This line is taken from mango:
> 
> typedef get opCall;

Can you tell us which module this was in?  I just tried a "Find In Files" operation on the Mango source and couldn't find it...  I'm intrigued by it though, if it is in use.

-- Chris Sauls
August 07, 2005
Sure, the link to the source file: http://mango.dsource.org/structIReader.html

Link to the line in documentation is: http://mango.dsource.org/structIReader.html#Readery1

Link to the line in source is: http://mango.dsource.org/IReader_8d-source.html#l00099

Wait a minute, the line in source now is
alias get opCall;
was it changed recently ? Althought the documentation still says
typedef get opCall;

-Sai


In article <dd4d8n$2tg1$1@digitaldaemon.com>, Chris Sauls says...
>
>sai wrote:
>> This line is taken from mango:
>> 
>> typedef get opCall;
>
>Can you tell us which module this was in?  I just tried a "Find In Files" operation on the Mango source and couldn't find it...  I'm intrigued by it though, if it is in use.
>
>-- Chris Sauls


August 08, 2005
"Sai" <Sai_member@pathlink.com> wrote in message news:dd66h6$14u5$1@digitaldaemon.com...
> Sure, the link to the source file: http://mango.dsource.org/structIReader.html
>
> Link to the line in documentation is: http://mango.dsource.org/structIReader.html#Readery1
>
> Link to the line in source is: http://mango.dsource.org/IReader_8d-source.html#l00099
>
> Wait a minute, the line in source now is
> alias get opCall;
> was it changed recently ? Althought the documentation still says
> typedef get opCall;

Hehe, I just tried the "typedef get opShr" and D said that I couldn't do that.  Look at this:

class A
{
 int x=5;
 void get(inout int blah)
 {
  blah=x;
 }

 alias get opShr;
}

void main()
{
 A a=new A;
 int x;
 a >> x;
 writefln(x);
}

Maybe a bug was fixed that didn't let you use "typedef" to do what "alias" can do.

It's an interesting use of alias, though, and something I never would have thought of.


Top | Discussion index | About this forum | D home