[fpc-devel] Porting FPC to IBM zArch
Sven Barth
pascaldragon at googlemail.com
Wed Jul 24 14:24:17 CEST 2013
Am 24.07.2013 14:18, schrieb Mark Morgan Lloyd:
> Sven Barth wrote:
>> Am 24.07.2013 12:37, schrieb Mark Morgan Lloyd:
>>> Jonas Maebe wrote:
>>>> On 24 Jul 2013, at 03:41, Bernd Oppolzer wrote:
>>>
>>>>> - Stanford Pascal (my version) allows (. .) and (/ /) as
>>>>> substitutes for [ ]
>>>>
>>>> FPC also supports (. and .). It doesn't support (/ and /) though.
>>>> Support for that could maybe be added under a new syntax mode or
>>>> mode switch switch, but is this a common syntax? I've never heard
>>>> of that one before.
>>>
>>> I'd suggest avoiding (/ /) as comments.
>>>
>>> Vector Pascal allows e.g. \+ as a reduction-addition operator, if
>>> FPC ever considered implementing anything like this it would be
>>> desirable to have \ and / unencumbered.
>>>
>>> http://www.dcs.gla.ac.uk/%7Ewpc/reports/compilers/compilerindex/vp-ver2.html
>>>
>>>
>> Hmm... I like the idea of array operators :) Could be added as an
>> additional modeswitch to avoid backwards compatibility problems with
>> overloaded operators for arrays...
>
> APL- where a lot of this comes from- uses / for reduction (knocks a
> dimension off, e.g. the total of the numbers in a list) and \ for scan
> (e.g. the running total of a list). I think it's desirable to avoid \
> because of its legacy as an escape in unix, some sort of efficient
> reduction is obviously a bit of a hot topic because of Google
> "map-reduce" etc.
>
> With the compiler as it stands, I've been able to define e.g.
> <variant> + <dynamic array>, define a variant constant "reduce", and
> then do e.g. a := reduce + b where b is an array. Which was all fine
> except that (at least when I last looked) there wasn't a compact
> notation for initialising a dynamic array, i.e. no b := (1, 2, 3, 4).
>
Interesting idea to "misuse" a Variant for that :)
If you have a named dynamic array type then you can use
"TMyArrayType.Create(1, 2, 3, 4)", though this only exists in Trunk
(reason: Delphi compatibility). My idea was to implement a Pascal like
way for this somewhen which would use "b := [1, 2, 3, 4]" (because in
code sections arrays are normally done using "[...]" instead of "(...)"
(which is used in constant sections)).
Regards,
Sven
More information about the fpc-devel
mailing list