Re: Why no schema alias?

Waldek Hebisch <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
Jay Michael wrote:
> 
> > On 13 Aug 2012 at 10:31, Jay Michael
> > wrote:
> > =
> 
> > >    type LSTRING = STRING ;
> > > 
> 
> > > t3.pas:8: warning: missing string capacity -- assuming 255
> > > 
> 
> > >  Is there some other syntax to creating an alias
> > > of a schema type?

You can rename identifiers on import or export from modules.
Unfortunatly, this does not work for builtion indentifiers
(in ideal world renaming of builtion identifiers should work,
but is currently unimplemented).

Depending on your purpose macro may do it:

{$define lstring string}

will cause all occurences of 'lstring' to be replaced by 'string'. 

>      I found a "Changes List" that includes the following:
> 
> # 19980722: don't allow type y(b:integer)=array[1..b] of integer;x=y; i=
> n --extended-pascal (fjf115a.pas)
> 
> # 19980405: allow type y(b:integer)=array[1..b] of integer; x=y; (fjf11=
> 5.pas)

At first glance this looks wrong: AFAICS Extended Pascal allows
schema aliases.  I wonder why author of the change thought otherwise.

> 
>      Why was STRING singled out as not allowed to have an alias?

For compatibility with Borland Pascal.  In Borland Pascal 'string'
is an alias for 'string(255)'.  Also few other Pascal dialects
work the same.  So for compatibility this is default in GNU
Pascal.  As I wrote I think that in Extended Pascal mode
string alias should be allowed.

-- 
                              Waldek Hebisch
[email protected] 

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.