[fpc-devel] Re: [fpc-l] type discussion

Gerhard Scholz gs at g--s.de
Wed Jun 1 18:35:07 CEST 2005


----- Original Message -----
From: "Marco van de Voort" <marcov at stack.nl>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Sent: Wednesday, June 01, 2005 1:50 PM
Subject: Re: [fpc-devel] Re: [fpc-l] type discussion


>... (shortened)

> >
> > Useful extensions I would see:
> >
> > bigger sets: set of -100000..100000 (e.g.)
>
> I'd like that too.

nice that we agree

>
> > a way to write integer constants in any base, not only
> > binary/octal/hexadecimal (not so important, but easy to implement)
>
> Rarely used. Specially since more than base 36 becomes a notational
problem.
> However it has been brought up before.
>

range 2..36 for the base should be enough. I have a working implementation;
notation is:
    base_digits (the base is in decimal, the digits then the usual 0..9a..z)
e.g.: 36_z = 35

seldom used, I admit, but easier to read than these $- and %- notations

>... (shortened)

> > more operators which can be overloaded (should follow the ALGOL68 rules)
>
> IMHO this is asking for a mess, and the use is limited.

sorry, I'm don't know that abbreviation: IMHO; the use might look limited,
but when implemented, people will find their use. ALGOL68 not only allowed
operators like + - // etc, but also words/identifiers.

>
> >     should automatically permit constructions like:
> >
> >            var
> >              x : type1,  y : type2 ;
> >
> >            x *:= y ;
>
> Why to save two characters? The C operators were afaik mostly added to
ease
> porting critical C code. However IMHO one shouldn't use them in new code,
> and there is no need to start adding variations on the C syntax.

X is just an example, more useful of course it is in situations like
    anArray[i,j]^ := anArray[i,j]^ * y ;
Similar to "inc(x)" compared to "x:=x+1"; in C (and if I remember correct,
ALGOL68 also) uses this as a hint for optimization: the reference to
anArray[i,j]^ is evaluated only once (similar as it is handled in an WITH
statement). I checked it with the FPC (nice that there are assembler files
as output); the GNU C compiler translates
  "arr[ii] += 1"
better than FPC.

Specially when C code is ported it is wise to look at the results; they
might be different!.

Beside, this is not C syntax, but ALGOL68 syntax, which is some years older.

>
> >  multiple assignments:
> >
> >      a := b := c := d := 0 ;
> >
> > etc.
>
> Same point. Totally useless.

easier to read, especially in sequencies of variable initializations

Greetings

Gerhard






More information about the fpc-devel mailing list