Recent

Author Topic: Discussion - What if fpc syntax becomes C-like?  (Read 3892 times)

jex

  • New Member
  • *
  • Posts: 23
Discussion - What if fpc syntax becomes C-like?
« on: April 03, 2020, 10:57:47 pm »
Hello,

I've just started learning Pascal. For the most part the syntax feels redundant or idk how to explain exactly. I'm sure some will get the idea
Now say that fpc is being written from the ground up as a new project, same language features, support etc, but just the syntax is more C-like. Would this bring a positive or a negative results?

Maybe more will start learning it (mainly because it'll be much easier to quickly pick it up for experienced programmers) or at least exploring it. Can it get the attention of big enterprises to maybe adopt it in some way? can it find the popularity that it truly deserves, because imo, I've just started learning it and so far I'm so impressed especially because it was built by the community. I really appreciate the tools and support FPC/Lazarus provides completely *FREE*. Nothing asked.

What do you think? Is that even technically possible?

In other words, what do you think is the main reason for FPC/Lazarus not getting the attention it deserves?

Bart

  • Hero Member
  • *****
  • Posts: 3850
    • Bart en Mariska's Webstek
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #1 on: April 03, 2020, 11:33:38 pm »
Making it more C won't attract more users.
If they want a C-ish language, there are plenty of them.

The verbosity and clarity of Pascal is what attracts me to the language in the first place.

Bart

circular

  • Hero Member
  • *****
  • Posts: 3359
    • Personal webpage
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #2 on: April 03, 2020, 11:43:45 pm »
I've just started learning Pascal. For the most part the syntax feels redundant or idk how to explain exactly. I'm sure some will get the idea
Now say that fpc is being written from the ground up as a new project, same language features, support etc, but just the syntax is more C-like. Would this bring a positive or a negative results?
I honestly have no idea what you're talking about. Can you provide an example?
Conscience is the debugger of the mind

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8553
  • FPC developer.
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #3 on: April 03, 2020, 11:52:17 pm »
I've just started learning Pascal. For the most part the syntax feels redundant or idk how to explain exactly. I'm sure some will get the idea
Now say that fpc is being written from the ground up as a new project, same language features, support etc, but just the syntax is more C-like. Would this bring a positive or a negative results?

I think you would get some weird hybrid, neither fish nor fowl.

Quote
Maybe more will start learning it (mainly because it'll be much easier to quickly pick it up for experienced programmers) or at least exploring it. Can it get the attention of big enterprises to maybe adopt it in some way?

As a completely new language it would first have to gain significant traction and a mature toolchain. Dozens of languages are launched weekly, the last one not introduced by a large corporation afaik is Python. (which is from 1991, but started to get traction only after 2000)

Moreover I don't agree with the premise in the first case. C and C syntax is terse and unwieldy to type (too many shifted letters). At first glance it looks shorter, but it is actually longer to type, typically.

Also the language would only the most superficial similarities to C, the kind of info that you get from a 20min reading session, so the benefits are so slim they are not even measurable.

And worse you still face the biggest and steepest hill, not syntax, but getting people from those popular languages to come over to your new minority language. They might grumble about syntax, but they'll just grumble on something else and stick with what they know.

So in short: IMHO hopeless :D

Quote
can it find the popularity that it truly deserves, because imo, I've just started learning it and so far I'm so impressed especially because it was built by the community. I really appreciate the tools and support FPC/Lazarus provides completely *FREE*. Nothing asked.

The big problem is that with a new language you throw away 50 years of source code and tooling and start over, and that for a vague principle that is hard to test and saves 10-20 minutes in the earliest part of the language learning.

Quote
What do you think? Is that even technically possible?

You would have to rewrite the entire parser, and redesign the whole dialect. Possible, but not trivial.

But the FPC project wouldn't be interested, so you would have to fork, create an own team, and do the work. An experienced couple devel could maybe redo the frontend to a somewhat workable state in an year. Maybe half an year if there are multiple persons that can work as a team, and assuming they are still students or in their first jobs so they can really spend a lot of time on it.

For unwashed newbies: hard to say. But long, very long.

But even then you only have the compilre, and you are years away from being on par, you have to redo IDE,xml,json classes *EVERYTHING* and  the kitchen sink:-)

Most likely some members lose steam or start to diverge in direction *HARD*.

Quote
In other words, what do you think is the main reason for FPC/Lazarus not getting the attention it deserves?

Looking at existing languages introduced or made popular in the last 10-15 years (Rust, Go, Ruby etc), that's obvious.  Not being invented or introduced by a large US corporation. Not being entrenched in a small circle of Silicon Valley venture capitalists at the right moment.

So in short: to fix the problem, give your mates the url to a ten finger typing course.
« Last Edit: April 03, 2020, 11:58:02 pm by marcov »

PascalDragon

  • Hero Member
  • *****
  • Posts: 1921
  • Compiler Developer
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #4 on: April 04, 2020, 11:38:21 am »
Now say that fpc is being written from the ground up as a new project, same language features, support etc, but just the syntax is more C-like. Would this bring a positive or a negative results?

Why should one? The idea of FPC is an open source Pascal compiler. It's even in the name: Free Pascal Compiler. Pascal languages (no matter if ISO Pascal, UCSD Pascal, Turbo Pascal, Virtual Pascal, Delphi, Oxygene) are clearly different from C-like languages. So if you don't like Pascal syntax, guess what: don't use it. There are enough C-like languages out there that you can choose from. It is the Pascal syntax that makes FPC different and thus stand out, and that's a good thing.

Sirius Black

  • New Member
  • *
  • Posts: 19
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #5 on: April 04, 2020, 11:45:13 am »
Hello,

I've just started learning Pascal. For the most part the syntax feels redundant or idk how to explain exactly. I'm sure some will get the idea
Now say that fpc is being written from the ground up as a new project, same language features, support etc, but just the syntax is more C-like. Would this bring a positive or a negative results?


AFAIK, except pascal, many programming languages more C-like, and don't forget, Pascal is old than C language, so who is more like each other?

Rainbow6

  • New Member
  • *
  • Posts: 17
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #6 on: April 04, 2020, 12:41:49 pm »
I think it doesn’t make sense, to make one language more like another.

In the programming language world there are 2 diametrical ideas. One where you form a “readable” language after natural languages (often English) - lets say Pascal, Modula, Oberon, COBOL, AppleScript/HyperTalk, ... And there is the other extreme where you heavily rely on special characters like Perl, C, C++, Lisp, ...

Most programming languages are somewhere in between these extremes - and this is good. Every programmer has it’s personal opinion on that - so if she/he likes, she/he can develop an own language that fits - but most of us are OK with what Wirth or Kernighan or Stroustrup have built.

Thaddy

  • Hero Member
  • *****
  • Posts: 10271
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #7 on: April 04, 2020, 01:43:25 pm »
Show me the grammar < >:D > if you succeed you are briliant, otherwise you are a donkey just like me... 8-)
Fact is C is more Pascal like with intentional (and unintentional: K&R did half a job) obfuscations..... :o
« Last Edit: April 04, 2020, 02:06:24 pm by Thaddy »
I am more like donkey than shrek

jamie

  • Hero Member
  • *****
  • Posts: 3241
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #8 on: April 04, 2020, 05:20:38 pm »
There are  few things in the C language that fpc could benefit from , some are already implemented..
 
 But there are a lot of things in the C++ level when it comes to class handling is a disaster in my opinion and that is where Object pascal shines.

 But getting back to basics here...

 The Boolean auto translation would save us loads of coding …
Example:

   if SomeInteger Then.....

   If SomeString Then...
etc
 what this means is simple...

 If value is 0 its false or string empty its false otherwise they are true...

 at the same time these identifiers can be used as Boolean or Value operators when it cones to performing the IF and WHILE loop control statements.

 We already have functions that work this way, why is it so hard for the compiler to see there is no assignment there and thus should assume a Boolean operation ?

 The same goes with Assigning a Booleaning..

ABoolean = SomeInteger;

 You notice how I didn't use the := ?

Anyways, I know this will never get implemented.
The usual answer is

"Bad Language Design" or "That's ugly " etc..

 Oh and while we are at it, the parser should be able to process a single or double quoted strings.

if it starts with a "....." it should be C style other wise starting with a ' is pascal style and so on..
at least this way escape chars can be used in the C-Style or make it easy to insert a single quote.

 
The only true wisdom is knowing you know nothing

Leledumbo

  • Hero Member
  • *****
  • Posts: 8242
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #9 on: April 05, 2020, 09:49:47 am »
The Boolean auto translation would save us loads of coding …
Example:

   if SomeInteger Then.....

   If SomeString Then...
etc
 what this means is simple...

 If value is 0 its false or string empty its false otherwise they are true...

 at the same time these identifiers can be used as Boolean or Value operators when it cones to performing the IF and WHILE loop control statements.

 We already have functions that work this way, why is it so hard for the compiler to see there is no assignment there and thus should assume a Boolean operation ?

 The same goes with Assigning a Booleaning..

ABoolean = SomeInteger;

 You notice how I didn't use the := ?

Anyways, I know this will never get implemented.
The usual answer is

"Bad Language Design" or "That's ugly " etc..
Ooo...that's ugly :P
Really, if you want an unsafely typed language, don't pick Pascal family. The only high level language today that can't differentiate a boolean and integer are direct C descendants. The hybrids and those inspired from both (Go, Java) know the benefit and implement boolean properly as its own, distinct type from integer. It's easy to implement, yes. But developing a language is not a matter of implementing it easily, because if that's the case, just use Assembly.

Thaddy

  • Hero Member
  • *****
  • Posts: 10271
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #10 on: April 05, 2020, 10:08:00 am »
Well, { = begin and } = end.... search and replace.... Curly brackets Pascal....
Don't use curly brackets for comments, though: as everyone knows all C code is always a comment in Pascal....  8-)

(Ok,Ok,Ok, that is a very old joke...)
« Last Edit: April 05, 2020, 10:19:19 am by Thaddy »
I am more like donkey than shrek

jc99

  • Hero Member
  • *****
  • Posts: 539
    • My private Site
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #11 on: April 05, 2020, 11:30:00 am »
The Boolean auto translation would save us loads of coding …
Example:

   if SomeInteger Then.....

   If SomeString Then...
[...]

ABoolean = SomeInteger;

 
Ooo...that's ugly :P
Really, if you want an unsafely typed language, don't pick Pascal family. The only high level language today that can't differentiate a boolean and integer are direct C descendants. The hybrids and those inspired from both (Go, Java) know the benefit and implement boolean properly as its own, distinct type from integer. It's easy to implement, yes. But developing a language is not a matter of implementing it easily, because if that's the case, just use Assembly.
Uagh ..  %) The first example still sends shivers down my spine ...
By the way for correct C-Syntax you (jamie) had to write
Code: C  [Select][+][-]
  1. if (SomeInteger)
  or
Code: C  [Select][+][-]
  1. if (SomeString)
in pascal
Code: Pascal  [Select][+][-]
  1. IF SomeInteger = 0 THEN
or
Code: Pascal  [Select][+][-]
  1. IF SomeString="" THEN
which looks much more readable to me and if you are used to
Code: Pascal  [Select][+][-]
  1. ABoolean := SomeInteger = 0;
  2. ABoolean2 := SomeInteger = 2;
it is a little more to type but it keeps it's consistency.
Also
Code: C  [Select][+][-]
  1. if (SomeString)
is not so obvious to me since strings are nullable classes in c#
Code: Pascal  [Select][+][-]
  1. IF assigned(SomeString) THEN [...]
  2. IF SomeString <> "" THEN [...]
  3. IF SomeString <> "0" THEN [...]
are also possible interpretations to me, and are much more readable in pascal.
@opaque: We have pascal++ (or pascal+1 to stay in the pascal-syntax) because c++ introduced the object-orientation to c which we have since object-pascal.
With delphi the pascal-language evolved even more, to a level like C# or java speaking of class-support, interfaces & generics.   
« Last Edit: April 05, 2020, 11:36:54 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

Thaddy

  • Hero Member
  • *****
  • Posts: 10271
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #12 on: April 05, 2020, 11:32:23 am »
Well, using UPPERCASE makes it BASIC, not Pascal.... and unreadable for me. My glasses do not help in such case.
It also tends the wear out the capslock and shift keys.....
I am more like donkey than shrek

guest58172

  • Guest
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #13 on: April 05, 2020, 12:14:54 pm »
Hello,

I've just started learning Pascal. For the most part the syntax feels redundant or idk how to explain exactly. I'm sure some will get the idea
Now say that fpc is being written from the ground up as a new project, same language features, support etc, but just the syntax is more C-like. Would this bring a positive or a negative results?

Maybe more will start learning it (mainly because it'll be much easier to quickly pick it up for experienced programmers) or at least exploring it. Can it get the attention of big enterprises to maybe adopt it in some way? can it find the popularity that it truly deserves, because imo, I've just started learning it and so far I'm so impressed especially because it was built by the community. I really appreciate the tools and support FPC/Lazarus provides completely *FREE*. Nothing asked.

What do you think? Is that even technically possible?

In other words, what do you think is the main reason for FPC/Lazarus not getting the attention it deserves?

From the syntax POV  no and it would be stupid. From the semantic POV I'd like to see 2 or 3 things

1. boolean evaluation of pointers and class instances
2. boolean evaluation of integers
3. implicit conversion from boolean to integer

1. boolean evaluation of pointers and class instances

Code: Pascal  [Select][+][-]
  1. if somePtr <> nil then ;

becomes

Code: Pascal  [Select][+][-]
  1. if somePtr then ;

same for class instances, interfaces.

2. boolean evaluation of integers

Code: Pascal  [Select][+][-]
  1. if someInt <> 0 then ;

becomes

Code: Pascal  [Select][+][-]
  1. if someInt then ;

3. implicit conversion from boolean to integer

Code: Pascal  [Select][+][-]
  1.  counter += Byte(someString[1] = 'a')

becomes

Code: Pascal  [Select][+][-]
  1. counter += someString[1] = 'a'

These 3 semantic changes are not breaking changes I think so they could be added without breaking code.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8553
  • FPC developer.
Re: Discussion - What if fpc syntax becomes C-like?
« Reply #14 on: April 05, 2020, 12:30:29 pm »
These 3 semantic changes are not breaking changes I think so they could be added without breaking code.

In some pointer cases autodereferencing might be a problem. Also you'll need more than the most mundane examples if you want to prove a point. Everybody knows what to do in the simple cases, it is the difficult cases that are the problem.

See e.g. https://www.freepascal.org/faq.html#extensionselect

 

TinyPortal © 2005-2018