Recent

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

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: The future of Free Pascal
« Reply #135 on: April 25, 2016, 04:23:11 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.
indeed, F1 worked :) I guess I never realized that wiki help works by default.

Did you notice that "Delete List" is only refreshed on the opening of the dialog.
If I've no lists, it would be disabled on start. But If I add some lists (without closing the dialog) it remains disabled.
Once I reopen the dialog "Delete List" is enabled, but doesn't get disabled even if I delete the last of them.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9867
  • Debugger - SynEdit - and more
    • wiki
Re: The future of Free Pascal
« Reply #136 on: April 25, 2016, 04:26:54 pm »
Did you notice that "Delete List" is only refreshed on the opening of the dialog.
Please report on mantis

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: The future of Free Pascal
« Reply #137 on: April 25, 2016, 04:28:31 pm »
btw, why it's own tab, rather than under Colors?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: The future of Free Pascal
« Reply #138 on: April 25, 2016, 04:28:51 pm »

Edson

  • Hero Member
  • *****
  • Posts: 1302
Re: The future of Free Pascal
« Reply #139 on: April 25, 2016, 04:38:39 pm »
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.

Pascal is not line-oriented language. It will destroy Pascal syntax.

Then why are there no multiline strings?

I ask the same. This is a feture I really love in other languages.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9867
  • Debugger - SynEdit - and more
    • wiki
Re: The future of Free Pascal
« Reply #140 on: April 25, 2016, 04:45:13 pm »
btw, why it's own tab, rather than under Colors?
Because it has plenty of settings other colors do not have. And they would not really fit on the color tab (keep in mind, that the option dlg may be resized, and quite small)

It is not just the word list, it is also the keysettings.
The other big use is that you can use it similar to "highlight word at caret". Define colors, and assign keystrokes, and you can highlight different terms in the editor by those keystrokes.
Can be very useful if you want to highlight a few identifiers that you try to trace through some code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9867
  • Debugger - SynEdit - and more
    • wiki
Re: The future of Free Pascal
« Reply #141 on: April 25, 2016, 04:50:21 pm »
Then why are there no multiline strings?

I ask the same. This is a feture I really love in other languages.
I know it is not the same, but the IDE can at least help a bit here.

it can add the necessary
Code: Pascal  [Select][+][-]
  1. ' + LineEnding +
  2.  '
if you press enter inside a string (or unfinished string)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: The future of Free Pascal
« Reply #142 on: April 25, 2016, 04:52:00 pm »
Because it has plenty of settings other colors do not have. And they would not really fit on the color tab (keep in mind, that the option dlg may be resized, and quite small)
But "Preview" of "Colors" is very helpful.
In the case of "User defined markup", it might ever need a sort of sandbox (where the text could be typed in).

Trying to configure it by switching between dialog and the editor is painful (especially, if there're many user lists entered already)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: The future of Free Pascal
« Reply #143 on: April 25, 2016, 04:55:03 pm »
Then why are there no multiline strings?
I ask the same. This is a feture I really love in other languages.
You must be hating JSON then :D

What line-break characters should be applied for such multi-line string? Should it be that's native to the system? or the one used in the source code?
Instead of leaving you guessing, pascal is just asking you to escape the line break explicitly, by adding #10 or #13#10 or a constant of you own choice. And then you'll be able to continue the constant from a new line.

BeniBela

  • Hero Member
  • *****
  • Posts: 906
    • homepage
Re: The future of Free Pascal
« Reply #144 on: April 26, 2016, 02:17:45 pm »
There could be  a compiler switch

After all, there are already some for the encoding. Choose the encoding of the line break

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: The future of Free Pascal
« Reply #145 on: April 26, 2016, 02:56:41 pm »
Lazarus seems to parse the indentation to automatically insert an end; at the right place

I'm talking about Free Pascal, since block structure is language.

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

Right is relative.

Quote
Line breaks are parsed as whitespace only. 

They are?


Yes.

Quote
Really?

Then why are there no multiline strings?

I assume you mean string literals.

1. there are, just use ' '  +  ''  syntax.
2. literals

As said in the umpteen discussions about that dead horse: it probably could be done, it is just not very pascalish, and there are too many variables
  (like should indentation be part of the string?)

Anyway, the whole string literal bit is not really related to block syntax, though of course the base philosophy that textual layout should not matter (or as little as possible) affects both.

Quote
They are not! Checkmate

One counter example doesn't fully invalidate a principle. 

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

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

(about if then ;)

I guess the compiler could easily emit an hint/warning for an empty statement ? While I would
favour syntax without single statements like M2), such constructs are not undetectable and thus
not beyond repair.

I just favour the M2 syntax because it is more compact and easier to read without IMHO significant technical downsides.

I actually came from M2 back to Pascal because of the larger codebases though. M2 is too small an island, and suddenly there was an open source Pascal. (this was summer '97 or so)
 
« Last Edit: April 27, 2016, 02:06:08 pm by marcov »

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: The future of Free Pascal
« Reply #146 on: April 27, 2016, 10:29:44 am »
That's also why using line breaks as syntax elements is not a good idea.
Agree.  But don't tell that to all those Python lovers:  They'll keell you...
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

AlexK

  • Jr. Member
  • **
  • Posts: 55
Re: The future of Free Pascal
« Reply #147 on: May 04, 2016, 11:30:20 am »
C++ was mentioned.
C++ is а problematic, dead-end bloated language. C++ compilers are good only at optimizing(after many years of work of corporate employees).

GCC accumulated a lot of incomprehensible craft of optimizations, and it becomes difficult to maintain(rumors).
Clang(LLVM Machine Code) uses own meta-assembler for optimizations.

C++ as language is so unsound that IDE can be created only using compiler as a service(only C++ compiler can parse C++ code).
C++ semantic language tools are a impossible, but some companies try hard to create them and make them somewhat useful for something.
Compilation itself is slowest in industry(many hours for big libraries), and it's usually faster than analysis in semantic tools.

Creation of good C++ IDE became possible only after libclang appeared. In Emacs,  RTags using libclang in a separate process works by accumulating all compiler messages from terminal during initial compilation, deduces a lot of info from them, to navigate code, to parse macros, etc. Different build systems must be treated specially to collect compiler messages, for RTags process to create a database of compiled project. But in the end it's a most featureful and robust IDE.

QT GUI library requires additional compiler(code generator) for slots/signals in widgets, MOC - Meta Object Compiler.
The only reason to create it was that C++'s RTTI abilities are problematic(introspection and reflection).

Quote
The moc tool reads a C++ header file. If it finds one or more class declarations that contain the Q_OBJECT macro, it produces a C++ source file containing the meta-object code for those classes. Among other things, meta-object code is required for the signals and slots mechanism, the run-time type information, and the dynamic property system.

The C++ source file generated by moc must be compiled and linked with the implementation of the class.

"Signals" is how they called events. "Slots" are event handlers. Additional compiler MOC because C++ lacks in RTTI and type safety.
Compare:
http://doc.qt.io/qt-4.8/signalsandslots.html
http://docwiki.embarcadero.com/RADStudio/Berlin/en/Events_(Delphi)

Another example, C's Gobject system in GLib for GTK+. Though it also allows creation classes at runtime, compatible with dynamic languages.

typinfo RTTI is important feature of the RTL in Free Pascal.
« Last Edit: May 04, 2016, 11:33:08 am by AlexK »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: The future of Free Pascal
« Reply #148 on: May 04, 2016, 01:47:47 pm »
One counter example doesn't fully invalidate a principle. 
Well: https://en.wikipedia.org/wiki/Falsifiability (Karl Popper is my hero, so I am biased)

The rest is a nice write up Marco.
« Last Edit: May 04, 2016, 01:49:22 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

AlexK

  • Jr. Member
  • **
  • Posts: 55
Re: The future of Free Pascal
« Reply #149 on: May 04, 2016, 07:03:21 pm »
Quote
Agree.  But don't tell that to all those Python lovers:  They'll keell you...

Python is OK.

Code: Pascal  [Select][+][-]
  1. {$modeswitch nestedprocvars}
  2. type TRetFunc = function: integer is nested;
  3. var func: TRetFunc;
  4.   function retNestedFunc: TRetFunc;
  5.   var num: integer;
  6.     function rf(): integer; begin
  7.       result := num;
  8.     end;
  9.   begin
  10.     num := 7;
  11.     result := @rf;
  12.   end;
  13. begin
  14.   func := retNestedFunc();
  15.   writeln(func()); { prints "7" }
  16.   writeln(func()); { prints "0", all subsequent calls of func return 0. }
  17. end.

I realistically don't expect it to create a closure, but nevertheless, why does first call to func() return 7...

EDIT:

That's actually an implication of the nestedprocvars mode switch, used only for backward compatibility with old pascal compilers.
« Last Edit: May 05, 2016, 03:46:39 am by AlexK »

 

TinyPortal © 2005-2018