Syntax changes suggestions

classic Classic list List threaded Threaded
113 messages Options
1 ... 3456
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Ben Grasset
On Fri, Jul 20, 2018 at 1:20 AM, Sven Barth via fpc-pascal <[hidden email]> wrote:
Because a feature might change the language in a way that's not in the spirit of the language. Look at how Delphi implemented attributes: they're declared in front of the types, fields, parameters, whatever, simply copied from how C# implemented them while in the spirit of Pascal they should have been *after* the declarations.

Regards,
Sven

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


C# itself is heavily inspired by Delphi though, as it's another Anders Hejlsberg project. I fail to see what the "spirit of the language" has to do with anything as far as attributes, either.

Shouldn't the attribute tags just be put wherever it's easiest for the compiler to deal with them?

I think the vast majority of people care far more about how useful Pascal actually is in real life than they do
about whether or not it fulfills some not-well-defined notion of "spirit". 

Also, as far as I can tell, most of the people who use FPC would consider the Delphi way to be the correct or normal way of doing things in the first place.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Ben Grasset
In reply to this post by R0b0t1
Isn't Delphi compatibility a major ongoing goal of both FPC and Lazarus, though? 

On Fri, Jul 20, 2018 at 10:01 AM, R0b0t1 <[hidden email]> wrote:
On Fri, Jul 20, 2018 at 12:20 AM, Sven Barth via fpc-pascal
<[hidden email]> wrote:
> Am 20.07.2018 um 00:53 schrieb Ben Grasset:
>>
>> If a feature works as intended and is useful (which is all that matters),
>> how is it "blind copying"?
>
> Because a feature might change the language in a way that's not in the
> spirit of the language. Look at how Delphi implemented attributes: they're
> declared in front of the types, fields, parameters, whatever, simply copied
> from how C# implemented them while in the spirit of Pascal they should have
> been *after* the declarations.
>

This is what bothers me about some of the Delphi extensions that are
requested, but also some things that are already in FPC. And like
other people have said: now it's too late. It's there forever, or a
length of time that is just as good when talking about software.

It's not to say all of these things are bad - it's just I wish more
thought would have gone into them. Perhaps that would mean changing
the feature so much that it doesn't resemble what was originally
proposed.

Cheers,
     R0b0t1
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Michael Van Canneyt
In reply to this post by Ben Grasset


On Sat, 21 Jul 2018, Ben Grasset wrote:

> On Fri, Jul 20, 2018 at 1:20 AM, Sven Barth via fpc-pascal <
> [hidden email]> wrote:
>>
>> Because a feature might change the language in a way that's not in the
>> spirit of the language. Look at how Delphi implemented attributes: they're
>> declared in front of the types, fields, parameters, whatever, simply copied
>> from how C# implemented them while in the spirit of Pascal they should have
>> been *after* the declarations.
>>
>> Regards,
>> Sven
>>
>> _______________________________________________
>> fpc-pascal maillist  -  [hidden email]
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>>
>
>
> C# itself is heavily inspired by Delphi though, as it's another Anders
> Hejlsberg project. I fail to see what the "spirit of the language" has to
> do with anything as far as attributes, either.
>
> Shouldn't the attribute tags just be put wherever it's easiest for the
> compiler to deal with them?

Exactly our point.

That would be behind the declaration, where all other modifiers are put
(default, stored, nodefault, or all procedure and variable modifiers)

Deciding to put them in front of the declaration broke years of tradition,
and most certainly was not leveraging existing compiler infrastructure.

>
> I think the vast majority of people care far more about how *useful
> Pascal actually is in real life* than they do
> about whether or not it fulfills some not-well-defined notion of "spirit".

I think even D7 pascal is useful in real life. I could easily work with it
still today, and need none of the things introduced afterwards. I am still
as productive as I was with D7.

Things that change my productivity are libraries to accomplish tasks,
not language features.

>
> Also, as far as I can tell, most of the people who use FPC would consider
> the Delphi way to be the correct or normal way of doing things in the first
> place.

For the features they introduced first, maybe.

But for operator overloading and (IIRC) generics, FPC introduced them first.
FPC also introduced the ObjC dialect to be able to import the native interfaces
of Mac.

Delphi decided to go another way in all of these cases.
Were they correct or normal ? I don't think so.
Did they consult with us ? No, they did not.

While we definitely want to be Delphi compatible, I don't think we're in
any way less of an authority on all things Pascal.

With the brain drain in Embarcadero of the last years, these days I would even claim the opposite.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Free Pascal - General mailing list
In reply to this post by Ben Grasset
Am 21.07.2018 um 22:43 schrieb Ben Grasset:
On Fri, Jul 20, 2018 at 1:20 AM, Sven Barth via fpc-pascal <[hidden email]> wrote:
Because a feature might change the language in a way that's not in the spirit of the language. Look at how Delphi implemented attributes: they're declared in front of the types, fields, parameters, whatever, simply copied from how C# implemented them while in the spirit of Pascal they should have been *after* the declarations.

Regards,
Sven

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


C# itself is heavily inspired by Delphi though, as it's another Anders Hejlsberg project. I fail to see what the "spirit of the language" has to do with anything as far as attributes, either.

Shouldn't the attribute tags just be put wherever it's easiest for the compiler to deal with them?
If we go by that then the current attribute syntax is especially bad, because the compiler now needs to gracefully fail with declarations like this:

=== code begin ===

[TSomeAttribute]
uses
  foobar;

=== code end ===

If there'd be a syntax to add them as postfix ones then it would be easier for the compiler (the following is merely an example):

=== code begin ===

type
  TSomeClass = class(TObject) with [TSomeAttribute]
    fSomeField with [TSomeOtherAttribute]: LongInt;
    property WhatEver: LongInt read fSomeField with [TYetAnotherAttribute];
  end;

=== code end ===


I think the vast majority of people care far more about how useful Pascal actually is in real life than they do
about whether or not it fulfills some not-well-defined notion of "spirit".
And that's why there are people who *do* care about it. Of course you can put everything and the kitchen think into a language. But if it doesn't fit the language than you'll simply end up with a melting pot that doesn't feel coherent. Also while people might not consciously think about the spirit of the language I think they'll feel if the language is coherent with itself or not.


Also, as far as I can tell, most of the people who use FPC would consider the Delphi way to be the correct or normal way of doing things in the first place.
Considering that more often than not there are discussions on these lists if we should continue to follow Delphi compatibility or not you might be surprised...

Regards,
Sven

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Jim Lee
In reply to this post by Ben Grasset



On 7/21/2018 1:43 PM, Ben Grasset wrote:

Shouldn't the attribute tags just be put wherever it's easiest for the compiler to deal with them?


That would be bending the language to fit the implementation, when it should be the other way around.

I think the vast majority of people care far more about how useful Pascal actually is in real life than they do
about whether or not it fulfills some not-well-defined notion of "spirit". 


Not me.  No computer language is a one-size-fits-all solution, nor should it be - though we have several  languages to choose from that are trying to be.

Also, as far as I can tell, most of the people who use FPC would consider the Delphi way to be the correct or normal way of doing things in the first place.


Again, not me.  Several Delphi features were rushed to meet a release deadline and were not well thought out.

-Jim


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Santiago A.
In reply to this post by Ben Grasset
El 21/07/18 a las 22:43, Ben Grasset escribió:

Shouldn't the attribute tags just be put wherever it's easiest for the compiler to deal with them?
No, of course the shouldn't.
They should be put put where it is easier for programmer, or more readable, or coherence, or common sense, or other reasons.
How difficult is to implement for the compiler is a limit if our skills or state of art of compilers imposes, not a feature.

--------
Saludos
Santiago A.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Ryan Joseph
In reply to this post by Free Pascal - General mailing list


> On Jul 22, 2018, at 4:54 AM, Sven Barth via fpc-pascal <[hidden email]> wrote:
>
> And that's why there are people who *do* care about it. Of course you can put everything and the kitchen think into a language. But if it doesn't fit the language than you'll simply end up with a melting pot that doesn't feel coherent. Also while people might not consciously think about the spirit of the language I think they'll feel if the language is coherent with itself or not.

The spirit of the language is really hard to define in my opinion. I think we all agree that if we changed begin/end to {} we would all be offended but why again is “auto” not in the spirit of the language? It looks like Pascal to me. Calling Free at the end of blocks and inside destructors feels like Pascal to me.

Telling the compiler to call it for me by typing “auto” instead of “Free” doesn’t feel non-pascal. I don’t get it.

type
        TMyClass = class
                private
                        list: TFPGList; auto;
                        otherList: TFPGList; auto;
        end;

var
        c: TMyClass; auto;

begin
        c := TMyClass.Create;


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Giuliano Colla
Il 23/07/2018 18:11, Ryan Joseph ha scritto:

> The spirit of the language is really hard to define in my opinion.

To the contrary, in an Open Source project, it is the easiest thing to
define.
It is what the core developers deem to be the spirit of the language.
That's all.

One should never forget what Open Source is: one or more persons,
because of their personal motivations (fun, technical interest,
altruism, egoistic desire to appear, whatever) decide to develop some
software in their free time, without getting any money for that, and to
share it with whomever is interested.

One should understand that it is *their* toy, not *our* toy.

We may suggest them to include new features, to modify existing ones,
but to accept or to reject them it is just their choice. You cannot
force them neither to spend their free time developing something they
don't like, nor to accept a patch which in their judgement would taint
their toy. It's as simple as that.

Open Source however provides an easy way out. If they don't like it, but
you do need it or just want it, you are free to implement whatever you
like on top of the existing project. Then you may just keep it for your
personal usage, or share it, giving rise to another OS project. That's
what Maciej Izak has done with its NewPascal.

If you don't know how to implement it, then you're in a worse situation,
because you cannot judge the implications of what you request, which
might require an effort not proportionate to the result, might conflict
with a lot of other things, etc. etc. You have no other choice than to
rely on core developers' judgement.

For those reasons I believe that this thread has become too long, and
that it would be reasonable to end it.

Just my 2 cents.

Giuliano

--
Do not do unto others as you would have them do to you.They might have different tastes.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

R0b0t1
In reply to this post by Ryan Joseph
On Mon, Jul 23, 2018 at 11:11 AM, Ryan Joseph
<[hidden email]> wrote:

>
>
>> On Jul 22, 2018, at 4:54 AM, Sven Barth via fpc-pascal <[hidden email]> wrote:
>>
>> And that's why there are people who *do* care about it. Of course you can put everything and the kitchen think into a language. But if it doesn't fit the language than you'll simply end up with a melting pot that doesn't feel coherent. Also while people might not consciously think about the spirit of the language I think they'll feel if the language is coherent with itself or not.
>
> The spirit of the language is really hard to define in my opinion. I think we all agree that if we changed begin/end to {} we would all be offended but why again is “auto” not in the spirit of the language? It looks like Pascal to me. Calling Free at the end of blocks and inside destructors feels like Pascal to me.
>
> Telling the compiler to call it for me by typing “auto” instead of “Free” doesn’t feel non-pascal. I don’t get it.
>
> type
>         TMyClass = class
>                 private
>                         list: TFPGList; auto;
>                         otherList: TFPGList; auto;
>         end;
>
> var
>         c: TMyClass; auto;
>
> begin
>         c := TMyClass.Create;
>

This looks ugly. It also introduces modifiers to variable
declarations. Some features should not be part of the language, they
should be built on top of it.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Free Pascal - General mailing list
R0b0t1 <[hidden email]> schrieb am Do., 26. Juli 2018, 09:53:
On Mon, Jul 23, 2018 at 11:11 AM, Ryan Joseph
<[hidden email]> wrote:
>
>
>> On Jul 22, 2018, at 4:54 AM, Sven Barth via fpc-pascal <[hidden email]> wrote:
>>
>> And that's why there are people who *do* care about it. Of course you can put everything and the kitchen think into a language. But if it doesn't fit the language than you'll simply end up with a melting pot that doesn't feel coherent. Also while people might not consciously think about the spirit of the language I think they'll feel if the language is coherent with itself or not.
>
> The spirit of the language is really hard to define in my opinion. I think we all agree that if we changed begin/end to {} we would all be offended but why again is “auto” not in the spirit of the language? It looks like Pascal to me. Calling Free at the end of blocks and inside destructors feels like Pascal to me.
>
> Telling the compiler to call it for me by typing “auto” instead of “Free” doesn’t feel non-pascal. I don’t get it.
>
> type
>         TMyClass = class
>                 private
>                         list: TFPGList; auto;
>                         otherList: TFPGList; auto;
>         end;
>
> var
>         c: TMyClass; auto;
>
> begin
>         c := TMyClass.Create;
>

This looks ugly. It also introduces modifiers to variable
declarations. Some features should not be part of the language, they
should be built on top of it.

While I don't support the "auto" idea, you are also wrong in saying that it "introduces" modifiers to variable declarations: there already are modifiers like "cvar", "public" and "external". 

Regards, 
Sven 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Ben Grasset
In reply to this post by R0b0t1
How is auto more "ugly" than literally any other modifier in the entire language? They're all just english words, of varying length. Also building features on top of a language will always result in worse performance than having them be a part of it.

On Wed, Jul 25, 2018 at 10:05 AM, R0b0t1 <[hidden email]> wrote:
On Mon, Jul 23, 2018 at 11:11 AM, Ryan Joseph
<[hidden email]> wrote:
>
>
>> On Jul 22, 2018, at 4:54 AM, Sven Barth via fpc-pascal <[hidden email]> wrote:
>>
>> And that's why there are people who *do* care about it. Of course you can put everything and the kitchen think into a language. But if it doesn't fit the language than you'll simply end up with a melting pot that doesn't feel coherent. Also while people might not consciously think about the spirit of the language I think they'll feel if the language is coherent with itself or not.
>
> The spirit of the language is really hard to define in my opinion. I think we all agree that if we changed begin/end to {} we would all be offended but why again is “auto” not in the spirit of the language? It looks like Pascal to me. Calling Free at the end of blocks and inside destructors feels like Pascal to me.
>
> Telling the compiler to call it for me by typing “auto” instead of “Free” doesn’t feel non-pascal. I don’t get it.
>
> type
>         TMyClass = class
>                 private
>                         list: TFPGList; auto;
>                         otherList: TFPGList; auto;
>         end;
>
> var
>         c: TMyClass; auto;
>
> begin
>         c := TMyClass.Create;
>

This looks ugly. It also introduces modifiers to variable
declarations. Some features should not be part of the language, they
should be built on top of it.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

Ryan Joseph
In reply to this post by R0b0t1


> On Jul 25, 2018, at 8:05 AM, R0b0t1 <[hidden email]> wrote:
>
> This looks ugly. It also introduces modifiers to variable
> declarations. Some features should not be part of the language, they
> should be built on top of it.


Yeah, introducing modifiers to variables is not so great. You could avoid introducing modifiers but using a new section like “scopevar” which is similar to “threadvar” I guess.

scopevar
  c: TMyClass;
begin
  c := TMyClass.Create;

I accomplish this in my code using an auto release pool which empties at the end of every event loop.

var
  c: TMyClass;
begin
  c := TMyClass.Create;
  c.AutoRelease;

// or
  c := TMyClass.Instance; // calls Create + AutoRelease in the constructor

That’s not so pretty either, involves extra constructors sometimes (if you want to keep things pretty) and it requires extra infrastructure you need to setup. Jonas told me once this is actually more efficient though since it frees multiple objects all at the same time so it decreases heap fragmentation (I think he meant). This idea is heavily utilized in all of Apple’s Cocoa frameworks so it’s a sound solution.


Meh, no free lunch, just food for thought. :)

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Syntax changes suggestions

R0b0t1
Well, I am also of the opinion that threadvar is kind of a kludge too.
I think part of the aesthetic of Pascal is that it reads fairly close
to English. Creating a lot of new compound words is a bit jarring.

As I just now figured out how to articulate the above, I have what I
think is a more consistent group of proposals. It will prevent needing
to create a lot of special keywords:

var
  c: thread TMyClass;
  d: auto TMyClass;


Or, perhaps even better:

thread var
  c: TMyClass;

managed var
  d: TMyClass;

Cheers,
     R0b0t1


On Thu, Jul 26, 2018 at 10:19 PM, Ryan Joseph
<[hidden email]> wrote:

>
>
>> On Jul 25, 2018, at 8:05 AM, R0b0t1 <[hidden email]> wrote:
>>
>> This looks ugly. It also introduces modifiers to variable
>> declarations. Some features should not be part of the language, they
>> should be built on top of it.
>
>
> Yeah, introducing modifiers to variables is not so great. You could avoid introducing modifiers but using a new section like “scopevar” which is similar to “threadvar” I guess.
>
> scopevar
>   c: TMyClass;
> begin
>   c := TMyClass.Create;
>
> I accomplish this in my code using an auto release pool which empties at the end of every event loop.
>
> var
>   c: TMyClass;
> begin
>   c := TMyClass.Create;
>   c.AutoRelease;
>
> // or
>   c := TMyClass.Instance; // calls Create + AutoRelease in the constructor
>
> That’s not so pretty either, involves extra constructors sometimes (if you want to keep things pretty) and it requires extra infrastructure you need to setup. Jonas told me once this is actually more efficient though since it frees multiple objects all at the same time so it decreases heap fragmentation (I think he meant). This idea is heavily utilized in all of Apple’s Cocoa frameworks so it’s a sound solution.
>
>
> Meh, no free lunch, just food for thought. :)
>
> Regards,
>         Ryan Joseph
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
1 ... 3456