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?
On a related note, when I tried
type LSTRING( Capacity : INTEGER ) = STRING( Capacity ) ; I got t3.pas:9: error: duplicate field `Capacity'
on the attempted type declaration, and again each time I used the new type name. I tried "STRING( LSTRING.Capacity )" and "STRING( .Capacity )". No improvement.
type LSTRING( N : INTEGER ) = STRING( N ) ;
compiled, and worked almost as well as a true alias. It wouldn't let me pass a string literal as the actual argument to a "const x : LSTRING" parameter.
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? On a related note, when I tried type LSTRING( Capacity : INTEGER ) = STRING( Capacity ) ; I
got t3.pas:9: error: duplicate field `Capacity'
on the attempted type declaration, and again each time I used the new type name. I tried "STRING( LSTRING.Capacity )" and "STRING( .Capacity )". No improvement.
type LSTRING( N : INTEGER ) = STRING( N ) ;
compiled, and worked almost as well as a true alias. It wouldn't let me pass a string literal as the actual argument to a "const x : LSTRING" parameter.
Const Len = 1024; Type LString = String (Len);
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
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?
I found a "Changes List" that includes the following:
# 19980722: don't allow type y(b:integer)=array[1..b] of integer;x=y; in --extended-pascal (fjf115a.pas)
# 19980405: allow type y(b:integer)=array[1..b] of integer; x=y; (fjf115.pas)
Why was STRING singled out as not allowed to have an alias?
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.