Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2022-05

Be careful of too many features

13 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Steve Litt

Hi all,

In 1984 I started my programming career with Whitesmith Pascal, and soon after Turbo Pascal 3, then C. C had the advantage of pointers to functions, Pascal had the advantages of better readability and less likelihood of errant pointers and buffer overruns. I did a little work with Object Oriented Turbo 5.5.

I'm totally pleased that FPC now has function references making callback routines possible. Closures are also nice. And I suppose under certain conditions anonymous functions are an asset, although my experience with Lua tells me it's easier and more readable to name a function temp243() and use it, rather than having a anonymous function sitting there in the middle of other code.

The example code I've seen in the "Feature Announcement: Function References and Anonymous Functions" not only doesn't look like any Pascal I've ever seen, but it resembles Perl (the "one language on a desert island" language before Python) in the huge number of syntax choices and the "many ways to do it" philosophy.

I programmed professionally in Perl for 4 years, until I ran across a shopping cart application written in a Perl so bizarre that I didn't recognize it as the language I'd used for four years. The "many ways to do it" philosophy had guaranteed that anyone good enough to do maintenance programming in Perl would have to learn not only the language, but every single little shortcut and longcut possible. I switched to Python. So did everyone else. Perl 6 never really made it because most people don't want a "many ways to do it" language, they want a simple language that can do anything. So people chose Python, and to a lesser extent Ruby and Lua, and Perl withered on the vine.

With the addition of callback functions, and the closures and events they bring to the table, you can go procedural, OOP, or to a degree functional. I think adding yet more features obfuscates and Perlizes Pascal.

SteveT

Steve Litt
March 2022 featured book: Making Mental Models: Advanced Edition http://www.troubleshooters.com/mmm

Reply by email

Rainer Stratmann
to Steve Litt
Steve Litt wrote
I think adding yet more features obfuscates and Perlizes Pascal.

What does Perlize mean?

Only a very little percentage of the code is using it. And you could easily do it in another way.
I also don't like make things complicated.
But they will do it anyway.

Reply by email

Steve Litt
to Rainer Stratmann

Rainer Stratmann via fpc-pascal said on Mon, 30 May 2022 21:22:48 +0200

Show quoted text 6 lines
Am Montag, 30. Mai 2022, 20:59:56 CEST schrieb Steve Litt via fpc-pascal: > I think adding yet more features obfuscates and Perlizes > Pascal. What does Perlize mean?

Perlize means to outfit a language with many different syntaxes (not algorithms, syntaxes) to do each task. Perlization works great until you work on somebody else's code, then it becomes a nightmare.

SteveT

Steve Litt
March 2022 featured book: Making Mental Models: Advanced Edition http://www.troubleshooters.com/mmm

Reply by email

Sven Barth
to Steve Litt: In 1984 I started my programming career with Whitesmith Pascal, and soon after Turbo…

Steve Litt via fpc-pascal schrieb am Mo.,
30. Mai 2022, 21:25:

Show quoted text 5 lines
With the addition of callback functions, and the closures and events they bring to the table, you can go procedural, OOP, or to a degree functional. I think adding yet more features obfuscates and Perlizes Pascal.

We are adding those features we deem useful or are sorely needed for Delphi compatibility especially when said feature allows something that isn't easily possible with existing functionality. This is the case for anonymous functions and function references.
Features that are merely syntactic sugar for existing functionality have a much lower chance to be implemented.

Regards,
Sven

Reply by email

Hairy Pixels
to Steve Litt: In 1984 I started my programming career with Whitesmith Pascal, and soon after Turbo…
Show quoted text 7 lines
On May 31, 2022, at 1:59 AM, Steve Litt via fpc-pascal wrote: The example code I've seen in the "Feature Announcement: Function References and Anonymous Functions" not only doesn't look like any Pascal I've ever seen, but it resembles Perl (the "one language on a desert island" language before Python) in the huge number of syntax choices and the "many ways to do it" philosophy.

Which part, the anonymous functions? FPC is very good about keeping new features behind mode switches you can disable all the cruft if you ever want to create plain procedural Pascal like in the 80s. :)

Regards,
Ryan Joseph

Reply by email

Steve Litt
to Sven Barth: Steve Litt via fpc-pascal schrieb am Mo., 30. Mai 2022, 21:25: We are adding those…

Sven Barth via fpc-pascal said on Mon, 30 May 2022 23:25:52 +0200

Show quoted text 12 lines
Steve Litt via fpc-pascal schrieb am Mo., 30. Mai 2022, 21:25: > With the addition of callback functions, and the closures and events > they bring to the table, you can go procedural, OOP, or to a degree > functional. I think adding yet more features obfuscates and Perlizes > Pascal. > We are adding those features we deem useful or are sorely needed for Delphi compatibility especially when said feature allows something that isn't easily possible with existing functionality.

As a Lazarus user, I thank you for that!

SteveT

Steve Litt
Spring 2022 featured book: Making Mental Models: Advanced Edition http://www.troubleshooters.com/mmm

Reply by email

Steve Litt
to Hairy Pixels: Which part, the anonymous functions? FPC is very good about keeping new features behind…

Hairy Pixels via fpc-pascal said on Tue, 31 May 2022 08:39:20 +0700

Show quoted text 10 lines
> On May 31, 2022, at 1:59 AM, Steve Litt via fpc-pascal > wrote: > > The example code I've seen in the "Feature Announcement: Function > References and Anonymous Functions" not only doesn't look like any > Pascal I've ever seen, but it resembles Perl (the "one language on a > desert island" language before Python) in the huge number of syntax > choices and the "many ways to do it" philosophy. Which part, the anonymous functions?

I think function references and to a lesser extent anonymous functions are necessities. Things I consider Perlization are things like inferring context of the receiving function, "Sort( @(left, right) begin", and other feature requests which basically are there to reproduce other languages. And especially syntactic sugar.

FPC is very good about keeping new features behind mode switches you can disable all the cruft if you ever want to create plain procedural Pascal like in the 80s. :)

A truly great language would be Turbo Pascal 5.5 (with OOP) plus function/procedure references.

That being said, I'm obviously not advocating removing features already there; I'm just saying if a feature isn't needed by Delphi/Lazarus, think long and hard about including it.

SteveT

Steve Litt
March 2022 featured book: Making Mental Models: Advanced Edition http://www.troubleshooters.com/mmm

Reply by email

Brian
to Steve Litt: In 1984 I started my programming career with Whitesmith Pascal, and soon after Turbo…
Steve Litt wrote
Hi all, In 1984 I started my programming career with Whitesmith Pascal,

Sorry for the off-topic post, folks, but this just opened a wound from my distant past... :(

I was a couple of years ahead of you, Steve, but at least in 1982 on the PDP-11, Whitesmith Pascal was a truly *awful* thing - a translation engine, not a compiler. It was a front end to Whitesmith C, which in turn translated to Macro-11 and then compiled and linked that (we watched these steps via RMD). The code produced was horribly inefficient (we looked at the Macro-11 listings), and using RSX-11M rather than M+, with no library space, code space was at a premium.

We quickly switched to Oregon Pascal (which DEC later bought as the foundation of RSX Pascal) and it was a *far* superior compiler. Apart from the debugger, that is, which took up so much space that you could just about debug 'Hello, world' and that was it.

Hopefully Whitesmiths improved in the couple of years before you started with it, or there was a better implementation if you used it on a machine other than a PDP-11.

Brian.

Reply by email

Steve Litt
to Brian

Brian via fpc-pascal said on Mon, 30 May 2022 22:36:00 -0400

Show quoted text 24 lines
On 5/30/22 14:59, Steve Litt via fpc-pascal wrote: > Hi all, > > In 1984 I started my programming career with Whitesmith Pascal, Sorry for the off-topic post, folks, but this just opened a wound from my distant past... :( I was a couple of years ahead of you, Steve, but at least in 1982 on the PDP-11, Whitesmith Pascal was a truly *awful* thing - a translation engine, not a compiler. It was a front end to Whitesmith C, which in turn translated to Macro-11 and then compiled and linked that (we watched these steps via RMD). The code produced was horribly inefficient (we looked at the Macro-11 listings), and using RSX-11M rather than M+, with no library space, code space was at a premium. We quickly switched to Oregon Pascal (which DEC later bought as the foundation of RSX Pascal) and it was a *far* superior compiler. Apart from the debugger, that is, which took up so much space that you could just about debug 'Hello, world' and that was it. Hopefully Whitesmiths improved in the couple of years before you started with it, or there was a better implementation if you used it on a machine other than a PDP-11.

It didn't get better. It got worse. By 1985, the same piece of code would successfully compile about 6 times out of 10. When you had all sorts of modules to compile, that meant SOMETHING would fail, and whatever make facility we had as I remember made us do the whole mass compile over again.

Through trial and error I observed that once it compiles successfully, it would compile several more times. So I created whatever you called shellscripts on RT-11, called PMA, which stood for "Positive Mental Attitude". It would compile a trivial program about 7 times, and only after that would it do the real compile. PMA increased our success a little.

I called Whitesmith in 1986 asking if this would be fixed and offering to help, and they told me they weren't doing any more work on their Pascal because only three companies worldwide still used it. At that point I reported that we'd need to rewrite in another language.

By the way, during the day I'd program in Whitesmith Pascal with its 10 minute compiles. By night I'd use Turbo Pascal 2, on a floppy driven Kaypro 2x running CPM, and compiles would take less than 10 seconds. And I could hit any memory location I wanted to, which later became essential for MS-DOS (remember B800?). I also wrote high level Turbo Pascal file readers that read the input file in huge and doled them out by the character or line, and that worked better than any of Turbo C's high or low level reads, or the Whitesmith I became a hired gun programmer and took my show on the road, for years I traveled with a Turbo Pascal 3 floppy in my pocket to work around whatever my customer's chosen language couldn't do. If you remember the Borland copyright (use like a book), this was perfectly within the license as long as I didn't actually install Turbo Pascal on the customer machine.

A year or so ago I took a Turbo Pascal program originally written in 1985, modified it slightly, ran it under Freepascal, and got the whole thing running except for the chiptunes music. The soundon() and soundoff() don't work on Linux. I'd love to find a way to get those working.

SteveT

Steve Litt
Spring 2022 featured book: Making Mental Models: Advanced Edition http://www.troubleshooters.com/mmm

Reply by email

Hairy Pixels
to Steve Litt: Hairy Pixels via fpc-pascal said on Tue, 31 May 2022 08:39:20 +0700 I think function…
Show quoted text 7 lines
On May 31, 2022, at 9:12 AM, Steve Litt via fpc-pascal wrote: I think function references and to a lesser extent anonymous functions are necessities. Things I consider Perlization are things like inferring context of the receiving function, "Sort( @(left, right) begin", and other feature requests which basically are there to reproduce other languages. And especially syntactic sugar.

Oh yeah those were just us with random ideas that don’t reflect the actual language. My first impression of this syntax is that it’s so verbose it’s going to make it hard to see the actual body of the function but that’s debatable.

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Steve Litt: Hairy Pixels via fpc-pascal said on Tue, 31 May 2022 08:39:20 +0700 I think function…

Steve Litt via fpc-pascal schrieb am Di.,
31. Mai 2022, 04:12:

Show quoted text 5 lines
Hairy Pixels via fpc-pascal said on Tue, 31 May 2022 08:39:20 +0700 > FPC is very good about keeping >new features behind mode switches you can disable all the cruft if you >ever want to create plain procedural Pascal like in the 80s. :)

Since I still don't receive Ryan's mails I'll abuse this to reply: While you can restrict what you write yourself with modeswitches you still need to be able to understand other people's code which might enable modeswitches you're not familiar with. Thus modeswitches are *not* the be all, end all solution and the argument "but you don't need to use it" will be completely ignored by us.

A truly great language would be Turbo Pascal 5.5 (with OOP) plus function/procedure references.

Well, you can enable them in TP mode as well ;)

Regards,
Sven

Reply by email

Liam Proven
to Steve Litt: Hairy Pixels via fpc-pascal said on Tue, 31 May 2022 08:39:20 +0700 I think function…
Steve Litt wrote
A truly great language would be Turbo Pascal 5.5 (with OOP) plus function/procedure references.

Oberon?

https://en.wikibooks.org/wiki/Oberon

Liam Proven ~ Profile: https://about.me/liamproven Email: ~ gMail/gTalk/FB: Twitter/LinkedIn: lproven ~ Skype: liamproven UK: (+44) 7939-087884 ~ Czech [+ WhatsApp/Telegram/Signal]: (+420) 702-829-053

Reply by email

Tomas Hajny
to Liam Proven
Liam Proven wrote 9 lines
On Tue, 31 May 2022 at 04:12, Steve Litt via fpc-pascal wrote: > > A truly great language would be Turbo Pascal 5.5 (with OOP) plus > function/procedure references. Oberon? https://en.wikibooks.org/wiki/Oberon

Please, everybody - this stream of the discussion (history, alternative past and current compilers, etc.) is a perfect fit for the fpc-other mailing list (and vice versa not for fpc-pascal).

Thanks

Tomas
(one of FPC mailing list moderators)

Reply by email