GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #9347

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: Gale Paeper
Subject: some problems
Date: 9 Sep 2003, 11:29:56

DOMINIQUE THILLAUD wrote:
[snip]
> 
> 2) export problem
> If I construct a module to implement an abstract type such that
> rational numbers, how export operators ?
> Writing :
> export rationals = (rational, +, -, *, /) ;
> give me a parse error before '+' (trying to enclose + between ' ' or "
> " is useless)

Extended Pascal's export-part is based on identifier spellings only
which doesn't really work well with the PASCAL SC operator overloading
extension which is based on operator symbols and operand type
signatures.  Since +, -, *, and / are operator symbols and not
identifiers, there is no explicit identifier spelling for overloaded
operators available for usage in an explicit export-list.

GPC does have an export all extension which doesn't require explicit
lists of identifier spellings which implicitly imcludes everthing
defined in the interface-part/module-heading in the exported interface.  Thus:

export rationals = all;

will, I think, implicitly include interface defined operators (e.g. +,
-, etc.) in the exported rationals interface.

Internally, GPC creates mangled function names for user
defined/overloaded operators.  The mangling scheme is based, I think, 
on a textual spelling of the operator symbol (e.g., PLUS for +) and the
operand parameter type identifier(s).  If one absolutely needs more
control over what's included in an exported interface than what export
all provides, determining what an operator's mangled function name is
and then using the mangled name in the export-list might work.  (I
haven't tried this.)    I wouldn't try to make use of this, though,
unless you deparately must have something more selective than export all
since it ties your code to changeable internal compiler details, is
error prone, and has a lot of negative code maintenance implications.

Gale Paeper
gpaeper@empirenet.com

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


Replies

Author Subject Date
Frank Heckenbach some problems 9 Sep 2003, 22:45:42

In reply to

Author Subject Date
DOMINIQUE THILLAUD some problems 9 Sep 2003, 09:00:33

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).