How does GPC support function/procedure overloading when it allows the declaration of parameters to be skipped when it comes to the implementation of a function/procedure?
I read somewhere that a function/procedure declaration in an interface need not be duplicated for the implementation. UIM, the text referred to Extended Pascal.
Say function foo is declared like this in the interface section of a module:
function foo(bar : integer) : some_return_type;
In the implementation, one could just do:
function foo; begin {do interesting stuff here} end;
Is it possible to overload foo (i.e., to accept a baz parameter, aside from bar) without resorting to having two code blocks with slightly different parameter declarations?
And on a slightly related question: Does GPC support, as an extension to Pascal, optional paramaters the way Ada supposedly does? If so, could someone please point me towards the direction I should go in order to find out how? If not, does anyone else think that this would be a useful extension?
Thanks for your time.
Neil Santos wrote:
How does GPC support function/procedure overloading when it allows the declaration of parameters to be skipped when it comes to the implementation of a function/procedure?
I read somewhere that a function/procedure declaration in an interface need not be duplicated for the implementation. UIM, the text referred to Extended Pascal.
Say function foo is declared like this in the interface section of a module:
function foo(bar : integer) : some_return_type;
In the implementation, one could just do:
function foo; begin {do interesting stuff here} end;
Is it possible to overload foo (i.e., to accept a baz parameter, aside from bar) without resorting to having two code blocks with slightly different parameter declarations?
No. At least in ISO7185 the forward declaration must include the forward attribute, as in:
FUNCTION foo(bar : integer) : some_return_type; FORWARD;
and the actual function declaration must either be a duplicate, omitting the FORWARD, or omit all parameter specifications. The purpose is to allow declaration of mutually recursive functions and procedures.
Pascal has NO function overloading.
CBFalconer wrote:
Neil Santos wrote:
How does GPC support function/procedure overloading when it allows the declaration of parameters to be skipped when it comes to the implementation of a function/procedure?
I read somewhere that a function/procedure declaration in an interface need not be duplicated for the implementation. UIM, the text referred to Extended Pascal.
Say function foo is declared like this in the interface section of a module:
function foo(bar : integer) : some_return_type;
In the implementation, one could just do:
function foo; begin {do interesting stuff here} end;
Is it possible to overload foo (i.e., to accept a baz parameter, aside from bar) without resorting to having two code blocks with slightly different parameter declarations?
No. At least in ISO7185 the forward declaration must include the forward attribute, as in:
FUNCTION foo(bar : integer) : some_return_type; FORWARD;
That's why Extended Pascal is ISO 10206. :-)
and the actual function declaration must either be a duplicate, omitting the FORWARD, or omit all parameter specifications.
Same in module implementations.
Frank
On Tue, Feb 24, 2004 at 04:13:33AM +0800, Neil Santos wrote:
How does GPC support function/procedure overloading when it allows the declaration of parameters to be skipped when it comes to the implementation of a function/procedure?
[...]
And on a slightly related question: Does GPC support, as an extension to Pascal, optional paramaters the way Ada supposedly does? If so, could someone please point me towards the direction I should go in order to find out how? If not, does anyone else think that this would be a useful extension?
GPC supports overloading only for operators, not functions. Optional parameters are not supported either; they could be sort of simulated by variable arguments ("..."), but these are meant only for compatibility with C libraries, it is not possible to define a Pascal function which uses varargs.
Emli Jerabek
Okay, got it; thanks to Emil Jerabek and Frank Heckenbach (though Frank quoted an e-mail from a CBFalconer that I don't seem to have received.
I have another question, though, if nobody minds. This should start a new thread, but I loathe wasting space in an e-mail message (enough space is wasted by my .sig :D)
Anyway, while coding, I noticed that:
AnObject.AFunction := RETURN_CODE;
resulted in an error during compilation (with no parameters to gpc, except file.pas, -o file and -Wall), but:
Self.AFunction := RETURN_CODE;
compiles cleanly. I was wondering if I'm using Self here as I should; RTFM'ing wasn't much help (`Self' is still under construction), and Google wasn't very helpful on this, either.
I know what Self does on other OO languages; was wondering if it's basically the same here.
TIA.
Neil Santos wrote:
I was wondering if I'm using Self here as I should; RTFM'ing wasn't much help (`Self' is still under construction), and Google wasn't very helpful on this, either.
Apparently, I wasn't using the right search terms. This:
http://pascal-central.com/OOE-stds.html#sect-6.5.2
answered my question. I apologize for the annoyance.
Neil Santos wrote:
Okay, got it; thanks to Emil Jerabek and Frank Heckenbach (though Frank quoted an e-mail from a CBFalconer that I don't seem to have received.
Maybe somethihng like this?
http://gnu-pascal.de/crystal/gpc/en/mail9822.html
Otherwise there might have been a (temporary?) mail transport problem. You can always use the archives. If there seems to be a permanent problem which you cannot explain, you might want to contact the list maintainer gpc-owner@gnu.de.
Self.AFunction := RETURN_CODE;
compiles cleanly. I was wondering if I'm using Self here as I should;
You figured it out already. Actually you can omit `Self.' (within a method, but that's where `Self' only works anyway) unless you have a local identifier `AFunction' shadowing the field (which most often happens within a `with' clause with an object of the same or "similar" type).
RTFM'ing wasn't much help (`Self' is still under construction), and Google wasn't very helpful on this, either.
The incomplete reference manual is one of the biggest "bugs" currently. If you like to help, any contribution is welcome.
Frank
Frank Heckenbach wrote:
quoted an e-mail from a CBFalconer that I don't seem to have received.
Maybe somethihng like this? http://gnu-pascal.de/crystal/gpc/en/mail9822.html
No, not really; my spam protection consists entirely of the Bayesian system in Mozilla. And besides, the only real spam I get annoyed with are those non-topic-related posts in the mailing lists I subscribe to. :)
Otherwise there might have been a (temporary?) mail transport problem. You can always use the archives. If there seems to be a
Could be. Either that, or Mozilla tagged CBFalconer's message as Junk and forgot to tell me about it. There's some mystic voodoo stuff involved in making SeaMonkey behave under GNU/Linux, it seems.
You figured it out already. Actually you can omit `Self.' (within
...
often happens within a `with' clause with an object of the same or "similar" type).
Ah. I have to remember that.
RTFM'ing wasn't much help (`Self' is still under construction), and
The incomplete reference manual is one of the biggest "bugs" currently. If you like to help, any contribution is welcome.
I would, and I do. But right there are some things that's further up my To-Do list, if you take my meaning.
Thanks again. :)
On Sun, Feb 29, 2004 at 02:34:36AM +0000, Neil Santos wrote:
Frank Heckenbach wrote:
quoted an e-mail from a CBFalconer that I don't seem to have received.
Maybe somethihng like this? http://gnu-pascal.de/crystal/gpc/en/mail9822.html
No, not really; my spam protection consists entirely of the Bayesian system in Mozilla. And besides, the only real spam I get annoyed with are those non-topic-related posts in the mailing lists I subscribe to. :)
Otherwise there might have been a (temporary?) mail transport problem. You can always use the archives. If there seems to be a
Could be. Either that, or Mozilla tagged CBFalconer's message as Junk and forgot to tell me about it. There's some mystic voodoo stuff involved in making SeaMonkey behave under GNU/Linux, it seems.
This is quite possible, I get all Chuck's posts flagged as spam by SpamAssassin. I don't quite understand the logic involved, but something is apparently broken on either yahoo.com or *.dial-access.att.net, the header is included below for completeness.
Emil
-------------------------------------- F
Emil Jerabek wrote:
This is quite possible, I get all Chuck's posts flagged as spam by SpamAssassin. I don't quite understand the logic involved, but something is apparently broken on either yahoo.com or *.dial-access.att.net, the header is included below for completeness.
Received: from yahoo.com +(25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net[12.76.130.25]) by worldnet.att.net (mtiwmhc11) with SMTP id <200402240558151110000st6e>; Tue, 24 Feb 2004 05:58:15 +0000 From: CBFalconer cbfalconer@yahoo.com Reply-To: cbfalconer@worldnet.att.net
* 2.6 FAKE_HELO_YAHOO Host HELO did not match rDNS: yahoo.com
This one is the biggest score item, and it seems to refer to the received header quoted (and some others might be as well).
AFAICS, it does look strange. Why would yahoo.com send mail to us via att.net? Chuck, do you happen to be sending your mail from a host at att.net, pretending to be yahoo.com? If so, that might be the source of the problem. Or do you actually send your mail through yahoo? Then yahoo would seem to do something strange ...
Frank
Frank Heckenbach wrote:
might be the source of the problem. Or do you actually send your mail through yahoo? Then yahoo would seem to do something strange ...
I think CBFalconer's reply to my post was caught as spam by my ISP, since I have no trace of it on my end. Also, I receive e-mail from people on Yahoo!, but I haven't seen any evidence of their mails being taken into the Unnamed Void (AKA /dev/null).
HTH.
Frank Heckenbach wrote:
Emil Jerabek wrote:
This is quite possible, I get all Chuck's posts flagged as spam by SpamAssassin. I don't quite understand the logic involved, but something is apparently broken on either yahoo.com or *.dial-access.att.net, the header is included below for completeness.
Received: from yahoo.com +(25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net[12.76.130.25]) by worldnet.att.net (mtiwmhc11) with SMTP id <200402240558151110000st6e>; Tue, 24 Feb 2004 05:58:15 +0000 From: CBFalconer cbfalconer@yahoo.com Reply-To: cbfalconer@worldnet.att.net
* 2.6 FAKE_HELO_YAHOO Host HELO did not match rDNS: yahoo.com
This one is the biggest score item, and it seems to refer to the received header quoted (and some others might be as well).
AFAICS, it does look strange. Why would yahoo.com send mail to us via att.net? Chuck, do you happen to be sending your mail from a host at att.net, pretending to be yahoo.com? If so, that might be the source of the problem. Or do you actually send your mail through yahoo? Then yahoo would seem to do something strange ...
My outgoing mail always has the (legitimate) from address of yahoo.com, with a reply-to: address of worldnet.att.net. It is (usually) physically delivered to att.net. yahoo is a spam trap, which nowadays never seems to get any real mail because yahoo hasn't figured out that spam should be deleted, rather than allowed to fill the mailbox and prevent further reception! (yahoo fills within an hour)
In addition, my own filters automatically reject anything addressed to att.net (without the worldnet) as spam, in fact anything not addressed specifically to cbfalconer@worldnet.att.net. The filters use the [gpc] tag to bypass this for this list.
I do not want to use an invalid from address, and it is extremely inconvenient to change it back and forth between e-mail and newsgroups.
CBFalconer wrote:
Frank Heckenbach wrote:
Emil Jerabek wrote:
This is quite possible, I get all Chuck's posts flagged as spam by SpamAssassin. I don't quite understand the logic involved, but something is apparently broken on either yahoo.com or *.dial-access.att.net, the header is included below for completeness.
Received: from yahoo.com +(25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net[12.76.130.25]) by worldnet.att.net (mtiwmhc11) with SMTP id <200402240558151110000st6e>; Tue, 24 Feb 2004 05:58:15 +0000 From: CBFalconer cbfalconer@yahoo.com Reply-To: cbfalconer@worldnet.att.net
* 2.6 FAKE_HELO_YAHOO Host HELO did not match rDNS: yahoo.com
This one is the biggest score item, and it seems to refer to the received header quoted (and some others might be as well).
AFAICS, it does look strange. Why would yahoo.com send mail to us via att.net? Chuck, do you happen to be sending your mail from a host at att.net, pretending to be yahoo.com? If so, that might be the source of the problem. Or do you actually send your mail through yahoo? Then yahoo would seem to do something strange ...
My outgoing mail always has the (legitimate) from address of yahoo.com, with a reply-to: address of worldnet.att.net. It is (usually) physically delivered to att.net.
AFAICS, it's not about the from address, but a strange received header (see above). If you deliver your mail to att.net, there's no yahoo.com host involved during sending, right? So the machine sending the mail to att.net (apparently 25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net, perhaps your own dialup account) is pretending to be yahoo.com, it seems. But the IP lookup proves this wrong and some spam filters take notice of this (because many spammers use faked hostnames).
Frank
Frank Heckenbach wrote:
CBFalconer wrote:
Frank Heckenbach wrote:
Emil Jerabek wrote:
This is quite possible, I get all Chuck's posts flagged as spam by SpamAssassin. I don't quite understand the logic involved, but something is apparently broken on either yahoo.com or *.dial-access.att.net, the header is included below for completeness.
Received: from yahoo.com +(25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net[12.76.130.25]) by worldnet.att.net (mtiwmhc11) with SMTP id <200402240558151110000st6e>; Tue, 24 Feb 2004 05:58:15 +0000 From: CBFalconer cbfalconer@yahoo.com Reply-To: cbfalconer@worldnet.att.net
* 2.6 FAKE_HELO_YAHOO Host HELO did not match rDNS: yahoo.com
This one is the biggest score item, and it seems to refer to the received header quoted (and some others might be as well).
... snip ...
My outgoing mail always has the (legitimate) from address of yahoo.com, with a reply-to: address of worldnet.att.net. It is (usually) physically delivered to att.net.
AFAICS, it's not about the from address, but a strange received header (see above). If you deliver your mail to att.net, there's no yahoo.com host involved during sending, right? So the machine sending the mail to att.net (apparently 25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net, perhaps your own dialup account) is pretending to be yahoo.com, it seems. But the IP lookup proves this wrong and some spam filters take notice of this (because many spammers use faked hostnames).
I see what you mean, and equally it appears to be out of my control. It smells to me as if the software handling the local mail dial-up creates that line out of my from: address and its own knowledge of the port involved. I don't expect to get anywhere complaining as a customer.
CBFalconer wrote:
Frank Heckenbach wrote:
CBFalconer wrote:
Frank Heckenbach wrote:
Emil Jerabek wrote:
This is quite possible, I get all Chuck's posts flagged as spam by SpamAssassin. I don't quite understand the logic involved, but something is apparently broken on either yahoo.com or *.dial-access.att.net, the header is included below for completeness.
Received: from yahoo.com +(25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net[12.76.130.25]) by worldnet.att.net (mtiwmhc11) with SMTP id <200402240558151110000st6e>; Tue, 24 Feb 2004 05:58:15 +0000 From: CBFalconer cbfalconer@yahoo.com Reply-To: cbfalconer@worldnet.att.net
* 2.6 FAKE_HELO_YAHOO Host HELO did not match rDNS: yahoo.com
This one is the biggest score item, and it seems to refer to the received header quoted (and some others might be as well).
... snip ...
My outgoing mail always has the (legitimate) from address of yahoo.com, with a reply-to: address of worldnet.att.net. It is (usually) physically delivered to att.net.
AFAICS, it's not about the from address, but a strange received header (see above). If you deliver your mail to att.net, there's no yahoo.com host involved during sending, right? So the machine sending the mail to att.net (apparently 25.hartford-02rh16rt-03rh15rt.ct.dial-access.att.net, perhaps your own dialup account) is pretending to be yahoo.com, it seems. But the IP lookup proves this wrong and some spam filters take notice of this (because many spammers use faked hostnames).
I see what you mean, and equally it appears to be out of my control. It smells to me as if the software handling the local mail dial-up creates that line out of my from: address and its own knowledge of the port involved. I don't expect to get anywhere complaining as a customer.
Perhaps if you explain to them the problems with spam filters ... Or else, why don't you use the att.net address as the sender?
Frank