Recent

Author Topic: The future of Free Pascal  (Read 229087 times)

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: The future of Free Pascal
« Reply #120 on: April 18, 2016, 10:04:05 pm »
D also has all its variables on the thread local storage (TLS), unless they are annotated with "__gshared" or "shared", and two multi thread paradigms: "MessageBoxes" that allow to easily send receive between threads and "Tasks". Even with mutable data you don't need to lock all the time, but only when you access non-TLS data. I think all modern compilers do something like that nowadays.

Actually I'd surprised if someone tells me that FPC doesn't put the variables declared in a class or a struct on the TLS.
Yes, local variables in FPC reside on the stack, which is thread-specific. Unless they're objects.

The main problem is in passing the messages and have the thread activate when a new message is received.

Linux likes pipes, which aren't randomly accessible. And Windows likes message loops, where only the primary thread can send them. Both don't have a mechanism where any thread can send a message to any other random thread. And for distributed processing, you might want to scale that "any" up to "any thread on any computer".

Edit: I do agree that Smalltalk was the best way to go. Objective-C (while a watered-down subset of Smalltalk), still has an edge on most everything else, as far as concurrency and scaling goes.
« Last Edit: April 18, 2016, 10:08:55 pm by SymbolicFrank »

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: The future of Free Pascal
« Reply #121 on: April 19, 2016, 11:17:28 am »
I like the try...finally...except...end idea, but your above code example without begin..end blocks is a nightmare in the making.
I don't think so. Unlike in 'old' Pascal, in newer Wirthian languages each if requires an end. Therefore your example would not be valid, and such syntax makes sense. You already use mentioned syntax with try..finally..end block. No need for begin/end and you can write more then one command inside of the block. If that is logical to you, I don't see any other reason beyond legacy for not liking it. Code looks much cleaner and easier to follow.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: The future of Free Pascal
« Reply #122 on: April 19, 2016, 11:26:41 am »
First, sorry for the late answer.  I was pretty busy.
@Ñuño_Martínez just asking why there is multiple engine and wrappers for making game with Pascal? is it good really in compare of other popular engine? what games these Pascal ones are good at?
I like Pascal very much but I want to know what can these Pascal engines do in compare of existence big and reliable engines?
There are multiple engine and wrappers for making games with any language.  Get C/C++:  You have Irrlitch, Unreal Engine and DooM engines, and you can go for older stuff and can use Build, Genesis3D and more.  If you go to libraries, you have DirectX, Allegro, SDL and more.

Since Pascal isn't a popular language, the most important advantage to use these engines/libraries in Pascal is to use our beloved language.  I think Pascal has some advantages over C in High Level development, and that's why I use it to build games.  But I use C some times too.  I never use C++ or C#: I don't like them.

About the topic, I think a lot of you would be happy using QuickBASIC.  Note I don't say VisualBasic, I've said QuickBASIC.  To be sincere, I miss QuickBASIC.
« Last Edit: April 19, 2016, 11:28:59 am by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Edson

  • Hero Member
  • *****
  • Posts: 1302
Re: The future of Free Pascal
« Reply #123 on: April 19, 2016, 11:29:21 pm »
You already use mentioned syntax with try..finally..end block. No need for begin/end and you can write more then one command inside of the block.

In fact, Pascals include such construction from the beginning, in the "REPEAT ... UNTIL" sentence, and later in the "CASE ... ELSE ... END". Both of them, presents blocks without BEGIN ... END.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: The future of Free Pascal
« Reply #124 on: April 20, 2016, 09:13:49 am »
To be sincere, I miss QuickBASIC.
Actually: I am missing Turbo/ PowerBasic.... Which once was QuickBasic on steroids.. ;)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: The future of Free Pascal
« Reply #125 on: April 20, 2016, 09:18:18 am »
Both of them, presents blocks without BEGIN ... END.
You forgot to mention labels ;) Which can also be blocks without begin end.

Oh, well, I should goto sleep..
« Last Edit: April 20, 2016, 09:23:28 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

ArtLogi

  • Full Member
  • ***
  • Posts: 184
Re: The future of Free Pascal
« Reply #126 on: April 22, 2016, 06:02:23 pm »
Both of them, presents blocks without BEGIN ... END.
You forgot to mention labels ;) Which can also be blocks without begin end.

Oh, well, I should goto sleep..
Gosub sleep`?
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: The future of Free Pascal
« Reply #127 on: April 22, 2016, 06:17:13 pm »
Both of them, presents blocks without BEGIN ... END.
You forgot to mention labels ;) Which can also be blocks without begin end.

Oh, well, I should goto sleep..
Gosub sleep`?

Naahhhh, I knew Pascal before Basic.... :o Apple ][e UCSD Pascal.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

kupferstecher

  • Hero Member
  • *****
  • Posts: 583
Re: The future of Free Pascal
« Reply #128 on: April 25, 2016, 01:20:07 pm »
I like the try...finally...except...end idea, but your above code example without begin..end blocks is a nightmare in the making.
I don't think so. Unlike in 'old' Pascal, in newer Wirthian languages each if requires an end. Therefore your example would not be valid, and such syntax makes sense.
In my opinion having both options (single statement and blocks) is quite usefull. I often use single line ifs and dos, it makes the code short and easy to understand.

In my code the if-structures always look somehow like this:
Code: Pascal  [Select][+][-]
  1. if x > 0 then SingleStatement;
  2.  
  3. if x > 0
  4. then SingleStatement;
  5.  
  6. if x > 0
  7. then SingleStatement
  8. else SingleStatement2;
  9.  
  10. if x > 0 then begin
  11.   Statement1;
  12.   Statement2;
  13. end else begin
  14.   Statement3;
  15.   Statement4;
  16. end;

A possible syntax could be using the line break after then-statement as indicator if its a single statement or a block with following end-statement.

The above statements then would look quite similar:
Code: Pascal  [Select][+][-]
  1. if x > 0 then SingleStatement;
  2.  
  3. if x > 0
  4. then SingleStatement;
  5.  
  6. if x > 0
  7. then SingleStatement
  8. else SingleStatement2;
  9.  
  10. if x > 0 then
  11.   Statement1;
  12.   Statement2;
  13. else
  14.   Statement3;
  15.   Statement4;
  16. end;

The following would be a syntax ERROR:
Code: Pascal  [Select][+][-]
  1. if x > 0
  2. then Statement1; //if-structure already finnished here.
  3.      Statement2;
  4. end;

The "single-line"-structure could even be extended allowing multiple statements in the same line:
Code: Pascal  [Select][+][-]
  1. if x > 0
  2. then found:= true; EXIT;

Such a syntax allows clear code without overhead.
Do-structures would look the same of course.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: The future of Free Pascal
« Reply #129 on: April 25, 2016, 01:30:51 pm »
Line breaks are parsed as whitespace only. Changing that would be very massive. (not that this is all academical).

I use a lot of single statement too, but I also have to change a lot of them to accommodate more commands later. The advantage of the mandatory end is that the IDE can always generate an end; to match and if etc.

Because that is so sure, the typing overhead of the mandatory end is small, while you save ALL block begins except procedural.

But of course totally new blocksystems are rarely invented. I would go with either M2 or Pascal, not combinations or even weirder stuff. And since this is the FreePASCAL forum this probably will be the case till a M2 mode is submitted  O:-)

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: The future of Free Pascal
« Reply #130 on: April 25, 2016, 01:38:52 pm »
The only time I ever use single-statement ifs is these:

Code: Pascal  [Select][+][-]
  1. if not Assigned(SomeParam) then Exit;

Because of the chance I overlook it and do things like:

Code: Pascal  [Select][+][-]
  1. if Something then
  2.   DoSomething;
  3.   DoOtherThings;
  4. if SomethingElse then Exit;
  5.  

That's also why using line breaks as syntax elements is not a good idea.

BeniBela

  • Hero Member
  • *****
  • Posts: 906
    • homepage
Re: The future of Free Pascal
« Reply #131 on: April 25, 2016, 02:07:44 pm »
Lazarus seems to parse the indentation to automatically insert an end; at the right place

Except for case statements. There it always puts the end; at the wrong place


Line breaks are parsed as whitespace only. 

They are?

Really?

Then why are there no multiline strings?

They are not! Checkmate

 
The only time I ever use single-statement ifs is these:
 ]

Because of the chance I overlook it and do things like:

Code: Pascal  [Select][+][-]
  1. if Something then
  2.   DoSomething;
  3.   DoOtherThings;
  4. if SomethingElse then Exit;
  5.  

 

Recently I overlooked a

Code: Pascal  [Select][+][-]
  1. if Something then ;
  2. DoSomething;
  3.  

and was confused. Never happened before. You really get too old for programming way too fast

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: The future of Free Pascal
« Reply #132 on: April 25, 2016, 02:19:20 pm »
Quote
Code: Pascal  [Select][+][-]
  1. if Something then ;
  2. DoSomething;

See pic, that issue can be made easy to spot. Since code completion sometimes places a ";" while typing the if condition, the problem is not that uncommon.

I detect it with 0 or 1 space. But one can add more space too. As long as the ; is on the same line.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: The future of Free Pascal
« Reply #133 on: April 25, 2016, 03:33:26 pm »
See pic, that issue can be made easy to spot. Since code completion sometimes places a ";" while typing the if condition, the problem is not that uncommon.

I detect it with 0 or 1 space. But one can add more space too. As long as the ; is on the same line.
Ugh... not sure about future of FreePascal, but looking at Lazarus configuration screen ... it is complex :)

btw, is the usage of "User defined markup" explained anywhere? I wouldn't guess to put the markup code into the column on the right.
« Last Edit: April 25, 2016, 03:38:59 pm by skalogryz »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: The future of Free Pascal
« Reply #134 on: April 25, 2016, 03:47:21 pm »
F1 should take you right here: http://wiki.lazarus.freepascal.org/IDE_Window:_Editor_User_Defined_Words

IIRC there was/is a request to make the list of word part more intuitive. Matter of time to spent on it.
« Last Edit: April 25, 2016, 03:53:27 pm by Martin_fr »

 

TinyPortal © 2005-2018