Why Pascal? lazarus / 8-Other ---------------------------------------------------------------------- stuey · 2018-04-05 23:16 Sometimes when I talk about my interest in Pascal (and I still know next to nothing about it, having only read Tao Yue's tutorial for super-n00bs) I get some pushback about why I'm not learning a hipper language like Ruby or Python. I don't really have a good answer to that... I think possibly the main reason I care about Pascal is because we had a TI 99/4A when I was a kid, and once you had graduated from its built-in TI BASIC and have thereafter mastered Exended BASIC (if you were lucky like I was to score EB from your parents), the next step up would have been UCSD Pascal; which, alas, I never did score. Also about eight years ago I was trying to get into Macintosh programming for the classic OS (I had a PowerBook G3 with OS 9.2.2 and managed to install MPW; I wanted to use it for C programming (yes I know Classic Mac OS is not an ideal C-programming platform!) and something in the doco said "uses Pascal-style function calls" which left me thinking, oh, great, now I have to learn Pascal on top of it all). Those weird little things combined with the mere fact that Pascal was a major, well-known programming language for such a long time, even though it's (reportedly) not the wave of the future, keep Pascal on my road map. What's Pascal to you? ---------------------------------------------------------------------- Phil · 2018-04-05 23:29 Quote from: stuey on April 06, 2018, 01:16:11 amWhat's Pascal to you? For me, Pascal is a good way to create dynamic (shared) libraries for use on multiple platforms and with many other languages. There are not too many other languages that can do this. Typically dynamic libraries are written with C++ or C. You would not use Python or Lua (or C# or VB.NET or Java) to write a dynamic library. Maybe Swift would be in this elite group (Pascal, C++, C) someday, but not yet. Where Pascal is not very useful is for creating the frontend to software on modern platforms (Web, mobile, macOS). In those cases it makes more sense to use languages that match up better with the target platform. It doesn't sound like you're a programmer, so some of what I've said may not make much sense. What are you looking at now? macOS? I would guess it might have been more than 8 years ago that you were looking at doing classic Mac app. OS X was released in 2001, I believe - that's 17 years ago when Classic started to be phased out. ---------------------------------------------------------------------- ccrause · 2018-04-06 08:22 Quote from: stuey on April 06, 2018, 01:16:11 amWhat's Pascal to you? In my opinion Pascal is just another programming language from a wide spectrum, with machine instructions and assembly at one extreme and Siri/Google Assistant at the other extreme.  One can construct endless arguments and comparisons between different languages to pick the "best" language. In my case using Pascal is purely a personal preference. I learned Pascal at school (after playing with BASIC and LOGO) hence I express most of my logic straight in Pascal.  I also learned to use C when I played with Arduino & AVR controllers, but it is a constant struggle for me to translate ideas from Pascal syntax to C syntax.  In the end I can program any logic I can think of in either C or Pascal.  I am reasonably sure that if I learned C first, I would probably prefer that to Pascal.  I also did some minor work in PHP and FORTRAN, but that was because of external factors (mainly availability of specific functionality).  Note that I am not a professional programmer. I like the Freepascal compiler because: It supports a wide range of targets.The online community is in general helpful and knowledgeable.The development team is usually quite tolerant and entertains discussion of a wide range of topics.Most bug reports are handled relatively quickly.It is fast.it is actively maintained and extended in terms of language features. ---------------------------------------------------------------------- RayoGlauco · 2018-04-06 11:11 I liked Delphi a lot, but its price was not affordable for my pocket. Then I discovered Lazarus. I think Pascal is a good language for a clear and good programming, because it was created initially for educational purposes. When I was in college, learning computer science, I saw several "dirty C programming" contests (the goal was to make a totally unintelligible C program that could do some interesting task), but no "Dirty Pascal programming" contests. ---------------------------------------------------------------------- Leledumbo · 2018-04-06 11:54 Quote from: stuey on April 06, 2018, 01:16:11 amWhat's Pascal to you? My weapon of choice when I'm not forced to use anything else specifically. One of a few language I can't have excuse like "it's compiling / building / packing / whatevershitthatmanymainstreamlanguageshave" because compilation is damn fast that compile-debug cycle has no need for interpreter (Hi, Haskell!) and release is practically a few seconds difference as opposed to minutes or hours (Long time no see, ReactJS! You again, Haskell!). All of those without any loss of performance or crazy memory hog, even deployment to server is a single static binary (not really, but at least the dependencies are usually against system level libraries, not application ones). No claim for single command installation (that does a bunch of downloading, installing, configuring, etc. that takes too long so we can go for a cup of coffee or tea and it's still not yet finished when we return) needed, because installation is not even required. ---------------------------------------------------------------------- Paul_ · 2018-04-06 12:05 Because I'm not so smart to program in C++ ---------------------------------------------------------------------- Lulu · 2018-04-06 12:17 Because I have learn Pascal in 1990, at school, and I love this language ! It is very clear to read by an human. I've discover Lazarus 6/7 years ago, and I also discover the world of Class ! ( only procedural in 1990 ) Thanks for the Lazarus team ! ---------------------------------------------------------------------- benohb · 2018-04-06 12:44 The subject is very deep . Part of the language itself Part about FPC and lazarus  team Another part about Linux and multi - platform By the way, this cheetah never got tired https://www.freepascal.org/pic/logo.gif ---------------------------------------------------------------------- Noodly · 2018-04-06 12:51 I've always loved Pascal and have been - many years ago - a professional developer using Turbo Pascal and then Delphi. After moving into managerial roles I used Delphi and later Lazarus to write personal utility programs or even the odd small production program when the developers were too busy. I can't think of anything you could do in C/C++ that you couldn't do in Pascal. As has been mentioned, the UI in mobile platforms is where Lazarus is weak (kudos to LAMW for pushing the boundaries), but it was never intended to be anything more than a multi-platform Delphi alternative. Overall it's fun to program with Lazarus and the community is very supportive. ---------------------------------------------------------------------- lainz · 2018-04-06 13:55 I discovered it thanks to Inno Setup, it mentioned "Pascal Script", so then I googled it to know a bit more. Then I'm here =) ---------------------------------------------------------------------- Bart · 2018-04-06 17:38 As a med student I followed an introduction course on programming in MUMPS, which was great fun. I didn't have a PC then (hardly anyone had, they were expensive), so only later I took up programming again. At the time I was unemployed and bored. A friend gave me a copy of Turbo Pascal 3.0 and a book on structural programming. The manual that came with TP was in Hebrew, so not helpfull at all to me. I started to learn how to program, and I really loved the fact that Pascal in itself is a structured language (ever tried MUMPS??). The compiler was lightning fast as well. Later in an attempt to learn a "mature language", I tried C. That horrified me. I could not and still cannot get my head around it. If you can read English, and you have some basic knowledge of logic, then you can understand a basic Pascal program, even if you never programmed in your life. With C, I get lost after the first 2, max 3 lines of code. So, I fell in love with Pascal long time ago, I had a fling with C and flead back. From all this you can see I'm an amateur, and always wil be. A pro would be able to learn C and more languages, and then choose the language that most suited the job at hand. For what I want to do, Pascal can do what I need. And it does that cross-platform. To me, it's just a matter of taste. Bart ---------------------------------------------------------------------- Ñuño_Martínez · 2018-04-10 10:57 For me, the best high-level compiled language.  Period. Quote from: Paul_ on April 06, 2018, 02:05:54 pmBecause I'm not so smart to program in C++ I was a C++ programmer but when I discovered Delphi I decided don't use C++ again in my life.  But I still like C though. ---------------------------------------------------------------------- mischi · 2018-04-10 11:16 I can easily use lazarus for a cross-platform user interface and then Pascal to call existing C or even Fortran routines. Try that with C :-). I knew Pascal at the time, when i got interested in Object Oriented Programming. In order to study this, i did not have to learn another language at the same time. Lazarus and Pascal may not be ideal, but gives me the best compromise. The best choice to understand my own code years later. MiSchi. ---------------------------------------------------------------------- marcov · 2018-04-11 17:41 Quote from: stuey on April 06, 2018, 01:16:11 amWhat's Pascal to you? While I favor the syntax a bit more than C syntax, the main motivation is the development experience as a whole. So language+libraries+tools. I particularly like the fact it can be used for easy to deploy basic win32/64 binaries. ---------------------------------------------------------------------- Zvoni · 2018-04-12 09:10 Coming from an 18-years-in-classic-visual-basic-background (no Pro though), FPC/Lazarus was the combination that appealed to me the most in terms of platform-independency/license-policy As already mentioned: Looking at C/C++-Code i go crosseyed after 3-4 lines of code :-) But as i stand here now, it's still a challenge to get through the differences between Freepascal and classic Visual Basic (e.g. no pointers or "real" inheritance in classic Visual Basic). Oh, and i agree: TP3 rocked my World in 1988 when finishing High School in Germany ---------------------------------------------------------------------- tverweij · 2018-04-12 09:55 - structured - strict - readable - case insensitive - full pointer support - full OOP (although multiple inheritance is missing) ---------------------------------------------------------------------- Thaddy · 2018-04-12 10:57 And a very strict separation of declaration and implementation throughout the language, which makes it not only easier to read but also less prone to errors than C like languages that allow e.g. variable declarations within a code block... even on the fly.... which is silly although it "saves time"... A variable declaration is much more readable and strict because of that separation. It prevents errors although it may seem more verbose. Same goes for types. Same goes for clumsy enumerations in other languages. Same goes for - native - sets. Btw: multiple inheritance is supported through interfaces... There are more languages with these strict features. Almost all of them are Wirthian languages which includes imo also ADA. Although COBOL has many of the same features I mentioned. ---------------------------------------------------------------------- segfault · 2018-04-15 18:27 Quote from: Thaddy on April 12, 2018, 12:57:13 pmSame goes for - native - sets. I think this is a much under-utilised and under-appreciated feature of the language. Well thought out use of sets can simplify many programs enormously and also makes them easier to read. I know you can implement them using bit vectors in pretty much any language, but how often would you actually do it? Having them native is a big plus. ---------------------------------------------------------------------- fcu · 2018-04-15 20:18 Quote from: Thaddy on April 12, 2018, 12:57:13 pmvariable declarations within a code block... even on the fly.... which is silly although it "saves time"... i find it very useful , better than scrolling every time to var region ! ---------------------------------------------------------------------- metis · 2018-04-23 14:25 @fcu Quotebetter than scrolling every time to var region !Relax Your Forefinger, and jump instead: Jump to the Var with , then jump back with .  @All the others I love Lazarus and FPC.  It installs fast and w/o Problems (at least with me: WinXP SP3). It is so easy to use, compiles and runs fast, and is full with useful Features, ... Question: Afaik, the first MacOs's had been written with Pascal. -> Does anybody know, why, and why Pascal was left ? ---------------------------------------------------------------------- Phil · 2018-04-23 14:30 Quote from: metis on April 23, 2018, 04:25:48 pm Afaik, the first MacOs's had been written with Pascal. -> Does anybody know, why, and why Pascal was left ? https://en.wikipedia.org/wiki/Object_Pascal#Early_history_at_Apple ---------------------------------------------------------------------- RAW · 2018-04-23 18:50 Quote@All the others I love Lazarus and FPC.  It installs fast and w/o Problems (at least with me: WinXP SP3). It is so easy to use, compiles and runs fast, and is full with useful Features, ... YES !!!! DEFINITELY !!!! I really like the SECONDARY INSTALLATION... ---------------------------------------------------------------------- metis · 2018-04-27 13:08 @Phil Referring to that article: "Apple dropped support for Object Pascal when they moved from Motorola 68K chips to IBM's PowerPC  architecture in 1994. MacApp 3.0, for this platform, was re-written in C++." -> So far, so good, but why did they have to change the programming language,      only because of changing the processor. Did Pascal not support it ?      (Sorry for these questions, but I'm only a Hobby-Programmer). ---------------------------------------------------------------------- Zoran · 2018-04-27 13:26 Quote from: Thaddy on April 12, 2018, 12:57:13 pmAnd a very strict separation of declaration and implementation throughout the language, which makes it not only easier to read but also less prone to errors than C like languages that allow e.g. variable declarations within a code block... even on the fly.... Ah, THE one argument I strongly disagree with. I believe that declaring variable only in the block where it belongs is what actually makes code not only less prone to errors, but also easier to read. "Don't declare variable outside of exact block they belong to" is what I really miss in Pascal. Quote from: Thaddy on April 12, 2018, 12:57:13 pm.... which is silly although it "saves time"... And it is not about saving time. ---------------------------------------------------------------------- Phil · 2018-04-27 13:44 Quote from: metis on April 27, 2018, 03:08:52 pm-> So far, so good, but why did they have to change the programming language,      only because of changing the processor. Did Pascal not support it ? I don't know, but I'm sure you can research that and find out. That was before my time as a Mac user. Apple has switched primary language several times. When they acquired NeXT and the OS / frameworks that would eventually become OS X and the Cocoa framework, they switched to Objective C. Then about four years ago they switched to their own homegrown Swift for all the Darwin platforms (macOS, iOS, tvOS, watchOS) as well as Linux. Now Google has forked Swift for use with TensorFlow. Pretty impressive growth for barely 4 years in. https://www.tensorflow.org/community/swift ---------------------------------------------------------------------- Leledumbo · 2018-04-28 20:36 Quote from: Zoran on April 27, 2018, 03:26:07 pmI believe that declaring variable only in the block where it belongs is what actually makes code not only less prone to errors, but also easier to read. "Don't declare variable outside of exact block they belong to" is what I really miss in Pascal. Quite the contrary, my experience with block level declaration makes my code buggier than the Pascal strict single declaration style. This is mainly due to the variable shadowing where you might unintentionally shadow the outer variable having the same name and type as the inner one and accidentally misrefer, either in outer or inner block. Not that often happen, but when it does, it really sucks to debug. ---------------------------------------------------------------------- ASerge · 2018-04-29 08:12 Quote from: Leledumbo on April 28, 2018, 10:36:42 pmQuote from: Zoran on April 27, 2018, 03:26:07 pmI believe that declaring variable only in the block where it belongs is what actually makes code not only less prone to errors, but also easier to read. "Don't declare variable outside of exact block they belong to" is what I really miss in Pascal. Quite the contrary, my experience with block level declaration makes my code buggier than the Pascal strict single declaration style. This is mainly due to the variable shadowing where you might unintentionally shadow the outer variable having the same name and type as the inner one and accidentally misrefer, either in outer or inner block. Not that often happen, but when it does, it really sucks to debug. Agreed. I prefer to do more complex logic in several blocks with nested functions. First, it is so easy in pascal. Second, a named block of code is very easy to understand and reduces the complexity of the code. And if you think about efficiency, "inline" will remove this issue. ---------------------------------------------------------------------- Thaddy · 2018-04-29 08:29 Indeed, but separation of even local declaration and implementation is by itself enough reason why I like Pascal over languages that allow inlined - as in within a implementation codeblock - variable declaration in code. That's a hell for debugging and also for team programming: you may have overlooked what another team member was doing. In Pascal you can examine the declaration block without having to search for any offending declaration with the implementation itself. And that is by design.  And IMO a very strong feature, since even properly written C(++) code will try to avoid that feature for the same reason. If you run into the need for such a variable you should look at a local function or procedure to handle it while in scope and indeed compiler inlining will do a good job in most such cases. ---------------------------------------------------------------------- Zoran · 2018-04-29 14:47 Okay, but to be complete I should also say that, while block scope in C++ (*) is a plus for me, lacking "routine nested in routine" Pascal feature is much bigger minus for C++. So, when comparing these two features, Pascal wins. (*) I prefer to write "C++" here, not "C-like languages", just because I think that among C, C++, Java, C#, C++ is the first to be compared with Object Pascal (object oriented, compiles to native code). ---------------------------------------------------------------------- Thaddy · 2018-04-30 07:06 It is a bit more complex than that since  Objective C is also a candidate here and - one year - older than C++. The "feature" that started this is C syntax. C++, objective C and Object Pascal can all be used in a procedural way too. They are supersets of course. To me the biggest disadvantage of C++ are its long compile times even if it leads to - not even always - very efficient code generation. ---------------------------------------------------------------------- kupferstecher · 2018-04-30 13:30 Quote from: Zoran on April 29, 2018, 04:47:11 pm"routine nested in routine" Pascal feature I quite hate that feature. The function name gets pulled away from its code. Besides I don't see why the feature would be needed, just reduces a bit typing. Anyways, I don't use it so in the end I'm fine with it. ---------------------------------------------------------------------- Zoran · 2018-04-30 16:37 Quote from: kupferstecher on April 30, 2018, 03:30:49 pmBesides I don't see why the feature would be needed, just reduces a bit typing. Reduces typing? No. It is not that trivial (and, by the way, it does not reduce typing -- you still have to write the whole function, don't you?). When you need some functionality inside a function, you can implement it only there, by creating nested function, whose scope is within the function it is nested in, so not polluting outer scope. This is far from trivial, as reducing typing would be, this gives one more possibility to avoid polluting the outer level scope -- a strong contribution to cleaner code. ---------------------------------------------------------------------- marcov · 2018-04-30 17:24 Quote from: kupferstecher on April 30, 2018, 03:30:49 pmI quite hate that feature. The function name gets pulled away from its code. Besides I don't see why the feature would be needed, just reduces a bit typing. Nested procedure can take parameters, so that is more than just typing. I like them a lot. The IDE keeps the procedure signatures (multiple, if nested) in the top lines even to assist. ---------------------------------------------------------------------- Handoko · 2018-04-30 17:50 Quote from: Zoran on April 30, 2018, 06:37:29 pmWhen you need some functionality inside a function, you can implement it only there, by creating nested function, whose scope is within the function it is nested in, so not polluting outer scope. +1 I rarely use nested procedure/function, but it is a feature I like very much. Using it properly it really makes the code more readable and maintainable. It's has been discussed here: http://forum.lazarus.freepascal.org/index.php/topic,38536.msg262013.ht ml#msg262013 ---------------------------------------------------------------------- Pascal · 2018-04-30 18:42 Quote from: Zoran on April 30, 2018, 06:37:29 pmWhen you need some functionality inside a function, you can implement it only there, by creating nested function, whose scope is within the function it is nested in, so not polluting outer scope.+1 It helps deduplicating code and making complex routines more readable by splitting code into meaningfull nested routines. ---------------------------------------------------------------------- Leledumbo · 2018-05-01 16:07 Quote from: kupferstecher on April 30, 2018, 03:30:49 pmI quite hate that feature. The function name gets pulled away from its code. Besides I don't see why the feature would be needed, just reduces a bit typing. Anyways, I don't use it so in the end I'm fine with it. Quite the contrary, you can name the nested subroutines very well according to their specific task inside the outer routine. And no, it doesn't reduce typing, it adds instead. But for the much more increased readibility and potentially prevent duplication, the more typing pays. This is a rather extreme example (you don't do this often), but imagine how will this be written without the nested subroutines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function Tokenize: TTokenList;var  StartLine,StartCol: LongWord;  Kind: TTokenKind;  Lexeme,ContextBasePath: String;  Look: Char;  TempState: TLexerState;   procedure InitFields;  begin    StartLine := Line;    StartCol := Col;    Lexeme := EmptyStr;  end;   procedure HandleText;  begin    case Look of      '{': begin        LexerState := lsPossiblyTagStart;      end;      else begin        Lexeme := Lexeme + Look;      end;    end;    Look := ReadChar;  end;   procedure HandlePossiblyTagStart;  begin    case Look of      '{': begin        if Lexeme <> EmptyStr then begin          AddToken(StartLine,StartCol,Kind,Lexeme,ContextBasePath,Result);        InitFields;        end;        LexerState := lsTagStart;      end;      else begin        Lexeme := Lexeme + '{' + Look;        LexerState := lsText;      end;    end;    Look := ReadChar;  end;   procedure HandleTagStart;  begin    case Look of      '{': begin        LexerState := lsUnescapedVariable;        Kind := tkUnescapedVariable;      end;      '&': begin        LexerState := lsUnescapedVariableAmp;        Kind := tkUnescapedVariable;      end;      '#': begin        LexerState := lsOpenSection;        Kind := tkOpenSection;      end;      '/': begin        LexerState := lsCloseSection;        Kind := tkCloseSection;      end;      'a'..'z','A'..'Z','_',' ': begin        LexerState := lsEscapedVariable;        Kind := tkEscapedVariable;        Lexeme := Look;      end;      else begin        raise ETokenize.Create('Invalid tag char: ' + Look);      end;    end;    Look := ReadChar;  end;   procedure HandlePossiblyTagEnd;  var    p: SizeInt;  begin    case Look of      '}': begin        Lexeme := Trim(Lexeme);        case TempState of          lsOpenSection: ContextBasePath := ContextBasePath + Lexeme + '.';          lsCloseSection: begin          if ContextBasePath = EmptyStr then              raise Exception.Create('Closing unopened section: ' + Lexeme)            else begin              p := RPos('.',ContextBasePath);              Delete(ContextBasePath,p,Length(ContextBasePath) - p);            end;          end;        end;        AddToken(StartLine,StartCol,Kind,Lexeme,ContextBasePath,Result);      InitFields;        LexerState := lsTagEnd;      end;      else begin        Lexeme := Lexeme + '}' + Look;        LexerState := TempState;    end;    end;    Look := ReadChar;  end;   procedure HandleTagEnd;  begin    LexerState := lsText;    Kind := tkText;  end;   procedure HandleVariable;  begin    case Look of      '}': begin        TempState := LexerState;        if LexerState = lsEscapedVariable then          LexerState := lsPossiblyTagEnd        else          LexerState := lsPossiblyUnescapedVariableEnd;      end;      'a'..'z','A'..'Z','0'..'9','_',' ','.': begin        Lexeme := Lexeme + Look;      end;      else begin        raise ETokenize.Create('Invalid tag char: ' + Look);      end;    end;    Look := ReadChar;  end;   procedure HandlePossiblyUnescapedVariableEnd;  begin    case Look of      '}': begin        LexerState := lsPossiblyTagEnd;      end;      else begin        raise ETokenize.Create('Invalid tag char: ' + Look);    end;    end;    Look := ReadChar;  end;   procedure HandleUnescapedVariableAmp;  begin    case Look of      '}': begin      TempState := LexerState;        LexerState := lsPossiblyTagEnd;    end;      'a'..'z','A'..'Z','0'..'9','_',' ','.': begin        Lexeme := Lexeme + Look;      end;      else begin        raise ETokenize.Create('Invalid tag char: ' + Look);      end;    end;    Look := ReadChar;  end;   procedure HandleSection;  begin    case Look of      '}': begin        TempState := LexerState;        LexerState := lsPossiblyTagEnd;      end;      'a'..'z','A'..'Z','0'..'9','_',' ','.': begin        Lexeme := Lexeme + Look;      end;      else begin        raise ETokenize.Create('Invalid tag char: ' + Look);    end;    end;    Look := ReadChar;  end; begin  Initialize(Result);  LexerState := lsText;   InitFields;  ContextBasePath := EmptyStr;  Look := ReadChar;  Kind := tkText;  while Look <> EOFChar do begin    case LexerState of      lsText                        : HandleText;    lsPossiblyTagStart            : HandlePossiblyTagStart;      lsTagStart                    : HandleTagStart;      lsPossiblyTagEnd            : HandlePossiblyTagEnd;      lsTagEnd                      : HandleTagEnd;      lsEscapedVariable,      lsUnescapedVariable         : HandleVariable;      lsPossiblyUnescapedVariableEnd: HandlePossiblyUnescapedVariableEnd;      lsUnescapedVariableAmp        : HandleUnescapedVariableAmp;      lsOpenSection,lsCloseSection  : HandleSection;    end;  end;  if Lexeme <> EmptyStr then begin    AddToken(StartLine,StartCol,Kind,Lexeme,ContextBasePath,Result);  end;end; The inner subroutines depend on local variables of the outer subroutine, so without nested subroutine feature, you will need to duplicate that for ALL of them. It's not just unnecessarily tedious, but can easily fail when you forget to mark one (or two or three or more) as var (every inner subroutine will both read and write those variables). Otherwise, you can just copy their bodies into the case statement, but... are you sure you really want to give up readability that much? ---------------------------------------------------------------------- Thaddy · 2018-05-01 16:29 @leledumbo: I agree with you but consider this: Unindent all...... After all, white space is actually ignored by most languages except Python....   It is up to the - not only Pascal! - programmer to respect it and make sense of it. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$macro on} {$define labas:='hello,'}{$define pasauli:='world'}program dosomethingsilly;begin;writeln(labas, pasauli);end.Btw: that's Lithuanian. My wife is... Point I am trying to make that this feature relies on programmer discipline. It is not a language feature of Pascal to make things understandable. It is a language feature to make things readable (after all) Not everybody has the gift of logic. Not even programmers. ---------------------------------------------------------------------- kupferstecher · 2018-05-01 21:02 Quote from: marcov on April 30, 2018, 07:24:09 pmNested procedure can take parameters, so that is more than just typing. I wasn't aware of that so I didn't see the point of nested functions. Already convinced! (From a code-readability point of view I'd prefere the nested functions to be placed below the "outer" function.) ---------------------------------------------------------------------- HeavyUser · 2018-05-01 21:15 Quote from: kupferstecher on May 01, 2018, 11:02:26 pm(From a code- readability point of view I'd prefere the nested functions to be placed below the "outer" function.) that is impossible in all known languages, all procedures/functions must be declared and compiled before they are used so above is the only appropriate place. ---------------------------------------------------------------------- Ñuño_Martínez · 2018-05-02 11:39 About nested procedures/functions:  C allows them.  Or they allowed in ANSI, not sure if C-99 and after allowed (I'm sure old GCC compilers do and some other don't, as Microsoft).  They work(ed) in a very similar way than Pascal ones.  I'm not sure if the actual language definitions allows them (I read somewere it is impossible to build a BNF depiction of C), and AFAIK it is not "standard".  I used them only once (in an old version of Allegro.pas, when an extra DLL was needed) and somebody asked because he can't compile it (Microsoft compiler). ---------------------------------------------------------------------- marcov · 2018-05-02 13:26 Afaik originally it was a gcc extension (maybe meanwhile standarized), but is syntax only. Afaik gcc doesn't implement children touching the parent variables or parameters. Without that, it is fairly superficial ---------------------------------------------------------------------- Leledumbo · 2018-05-02 14:27 Nope, it's not (yet?) standardized in C, not in C99, not even in C11. It remains a GCC specific extension as Clang also doesn't implement it. ---------------------------------------------------------------------- Ñuño_Martínez · 2018-05-02 15:44 Quote from: marcov on May 02, 2018, 03:26:08 pmAfaik originally it was a gcc extension (maybe meanwhile standarized), but is syntax only. Afaik gcc doesn't implement children touching the parent variables or parameters. May be not now, but it did allow to use parent variables and parameters.  I can't find the code right now (I've found it wasn't in the old Allegro.pas code ) but I did it and it worked. Anyway, as you said, it isn't standard so it is not a good idea to do it.  As I've said somebody said it didn't compiled in his system. ---------------------------------------------------------------------- metis · 2018-05-08 10:56 @Zoran Quote"Don't declare variable outside of exact block they belong to" is what I really miss in Pascal.How would You declare global Vars then ? @All the others What I really miss in Pascal, is the Possibility to declare static Vars within a Routine. Maybe this is a good Opportunity to turn the Discussion to... What is missing in Pascal ? What can not be done with Pascal without "big Detours" ? ---------------------------------------------------------------------- Handoko · 2018-05-08 11:01 Quote from: metis on May 08, 2018, 12:56:23 pmWhat I really miss in Pascal, is the Possibility to declare static Vars within a Routine. Did you mean local typed constants? It should be stressed that typed constants are automatically initialized at program start. This is also true for local typed constants and initialized variables. Local typed constants are also initialized at program start. If their value was changed during previous invocations of the function, they will retain their changed value, i.e. they are not initialized each time the function is invoked. Source: https://freepascal.org/docs-html/ref/refse10.html ---------------------------------------------------------------------- metis · 2018-05-08 11:10 @Handoko No, I mean Vars, that are declared in a Routine and keep their Value until the next Call. ---------------------------------------------------------------------- Handoko · 2018-05-08 11:16 Have you read the link? Typed constant is not the constant that you thought. Contrary to ordinary constants, a value can be assigned to them at run-time. Source: https://freepascal.org/docs-html/ref/refse10.html ---------------------------------------------------------------------- Pascal · 2018-05-08 11:16 Quote from: metis on May 08, 2018, 01:10:45 pm@Handoko No, I mean Vars, that are declared in a Routine and keep their Value until the next Call.  That's what he meant! It's possible: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure xyz;const  lLock: boolean = False;begin  if lLock then exit;  lLock := True;  try    ...  finally    lLock := False;  end;end; ---------------------------------------------------------------------- Thaddy · 2018-05-08 11:45 Indeed, the most use for a typed const is to maintain state over function calls, it behaves like a persistent (global) var, not a local var but is hidden from global access.. This is a slightly more revealing example that I have given before: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program untitled;{$ifdef fpc}{$mode delphi}{$H+}{$J+}{$endif}function MaintainStateOverCall:integer;const x:integer = 0;begin  Result := x;  inc(x);end; var i:integer;begin  for i := 0 to 9 do   writeln(MaintainStateOverCall);end.It is a very powerful tool once you know how to use it. The alternative is writing a class, but this feature is much older and a precursor to Object Pascal. ---------------------------------------------------------------------- Pascal · 2018-05-08 11:52 Quote from: Thaddy on May 08, 2018, 01:45:25 pmThis is a slightly more revealing example Sure! ---------------------------------------------------------------------- Thaddy · 2018-05-08 12:03 Quote from: Pascal on May 08, 2018, 01:52:00 pmSure!  Note you need to have {$writeableconst on} or the equivalent {$J+} for this to work. ---------------------------------------------------------------------- Handoko · 2018-05-08 12:08 It works on {$mode objfpc} too. Every times I start a new project using Lazarus, I get {$mode objfpc} and I can use typed constant without problem. ---------------------------------------------------------------------- Kays · 2018-05-08 12:21 Quote from: Thaddy on May 08, 2018, 01:45:25 pmIndeed, the most use for a typed const is to maintain state over function calls, it behaves like a persistent (global) var, not a local var but is hidden from global access.. […] The alternative is writing a class, but this feature is much older and a precursor to Object Pascal. Or a unit where the var is allocated in the implementation section. Quote from: Thaddy on May 08, 2018, 02:03:53 pm[…] {$writeableconst on} […]One of the worst compiler switches, ever (besides {$COperators on}). I mean constants, hence their name are supposed to remain constant, i.e. you can't assign any value to them. ---------------------------------------------------------------------- Thaddy · 2018-05-08 12:21 That would actually be a bug. Same goes for mode delphi. In delphi it should be off by default. Oh, minor issue. ---------------------------------------------------------------------- Thaddy · 2018-05-08 12:26 Quote from: Kays on May 08, 2018, 02:21:08 pmOne of the worst compiler switches, ever (besides {$COperators on}). I mean constants, hence their name are supposed to remain constant, i.e. you can't assign any value to them. No it is not: it is a constant over calls, not a traditional constant without type (which many people will probably also do not understand: how to determine the type of a constant....). Actually this is THE compiler feature (internally) that allowed OOP in pascal. And sometime later lead to Object Pascal and subsequently Delphi and FreePascal. And the difference is actually quite well explained in the manuals. Being able to hide from global scope is a feature that allows classes and objects. That was a really silly remark, Kai. You can do much better. ---------------------------------------------------------------------- Zoran · 2018-05-08 13:16 However, the syntax is quite unfortunate. I never understood why are these declared with const keyword. Perhaps we should call these global variables with local scope (although accessible from local scope only, they are allocated in global memory region). Of course, as we know what we are doing, there is nothing wrong with using this feature. ---------------------------------------------------------------------- Thaddy · 2018-05-08 13:29 Quote from: Zoran on May 08, 2018, 03:16:50 pmHowever, the syntax is quite unfortunate. I never understood why are these declared with const keyword. Perhaps we should call these global variables with local scope (although accessible from local scope only, they are allocated in global memory region). Of course, as we know what we are doing, there is nothing wrong with using this feature. I somewhat agree with you, but note typed consts are typed. So although const necessarily  has a different meaning it is quite natural. I would worry more about open array parameters vs dynamic array parameters. Now that's a clash that is hard to understand for most. ---------------------------------------------------------------------- Zoran · 2018-05-08 14:43 Quote from: Thaddy on May 08, 2018, 03:29:52 pm but note typed consts are typed. So although const necessarily  has a different meaning it is quite natural. Typed? Natural? What makes it typed? Seriously, why do we call these typed? A true const also have its type. Only you don't always have to type its type. Is that what makes it not typed? Not to mention that you can declare true constant's type explicitly, as well: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  N = Int64(123); // a true const ---------------------------------------------------------------------- Zoran · 2018-05-08 14:46 Quote from: metis on May 08, 2018, 12:56:23 pm@Zoran Quote"Don't declare variable outside of exact block they belong to" is what I really miss in Pascal.How would You declare global Vars then ? Are you serious? I'd do it this way: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  N: Integer; ---------------------------------------------------------------------- lainz · 2018-05-08 16:54 Quote from: Zoran on May 08, 2018, 04:46:24 pmQuote from: metis on May 08, 2018, 12:56:23 pm@Zoran Quote"Don't declare variable outside of exact block they belong to" is what I really miss in Pascal.How would You declare global Vars then ? Are you serious? I'd do it this way: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  N: Integer;  He means in each scope. With your code you are creating a variable for all function scope, that doesn't means is the local scope, for example a 'for scope' or an 'if scope', in other languages variables are local to the if or local to the for. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i functionbegin // function scope for ... dobegin // for scope if ... thenbegin // if scope end // if scope end // for scope end // function scope ---------------------------------------------------------------------- Thaddy · 2018-05-08 19:37 Quote from: Zoran on May 08, 2018, 04:43:01 pmQuote from: Thaddy on May 08, 2018, 03:29:52 pm but note typed consts are typed. So although const necessarily  has a different meaning it is quite natural. Typed? Natural? What makes it typed? Not to mention that you can declare true constant's type explicitly, as well: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  N = Int64(123); // a true const That is a constraint, not a type. A const is typeless, usually platform dependent as well. Only its value is guaranteed. A const is evaluated by the compiler and can be substituted by a fixed value without storage. A typed const has an actual storage allocation. Basics.... ---------------------------------------------------------------------- ASBzone · 2018-05-09 01:55 Way back when, I wanted to be a programmer... I learned BASIC on a TRS-80, then on other home computers from TANDY, then on the C-64. I also learned Assembler on the C-64. In 1986, I ran into Pascal on a DEC PDP-11/44 at college -- it was awesome. I started looking for Pascal everywhere. Back on the PC, I got into BASIC again, and into dabbled briefly in Assembler again.  I did QuickBasic and AmigaBASIC (my favorite BASIC interpreter). I dabbled in VisualBasic, but was not too impressed. I started working as a hardware guy, not a software guy, and my career took off.    I still programmed, sporadically, as a hobby...   I loved TurboPascal. Delphi came out, and I was in awe.  Loved it, loved it, loved it. I also started learning C and C++.  Meh.   Nice languages, but nothing like Pascal for me (totally subjective sentiment). Back in 2011, I found the need to write some utilities for systems management purposes, and after playing around with Visual C++, I came across FPC and Lazarus, and felt right at home. It works for me. If I had never run into Pascal, I would probably have gone on to master C++ and later C#, since I spend most of my time on Windows systems these days. For me, Pascal just happened to suit my personality, and has been quite capable of doing all that I have needed.  (These days, I am mostly writing console utilities, but I have some additional software plans ahead. ---------------------------------------------------------------------- ASBzone · 2018-05-09 01:58 Quote from: Thaddy on April 12, 2018, 12:57:13 pmAnd a very strict separation of declaration and implementation throughout the language, which makes it not only easier to read but also less prone to errors than C like languages that allow e.g. variable declarations within a code block... even on the fly.... which is silly although it "saves time"... I was *just* having that discussion with my teenage son yesterday, as he was lamenting the structure of Pascal, in favor of the *flexibility* of Python. ---------------------------------------------------------------------- engkin · 2018-05-09 02:49 Since this thread is in a forum for "Pascal" it will be more like glorifying Pascal as a programming language. Quote from: ASBzone on May 09, 2018, 03:55:58 amI also started learning C and C++.  Meh.   Nice languages, but nothing like Pascal for me (totally subjective sentiment). Thank you for being objective here. I would like to remind Pascal lovers of the following cryptic list of local and global compiler directives: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$A}{$B}{$C }{$D}{$E}{$F}{$G}{$H}{$I}{$J}{$L}{$M}{$N}{$O}{$Q}{$R}{$S}{$T}{$V}{$W}{ $X}{$Y}{$Z}  You should not use any of them, if you really care about your code being easy to read, you know. If you see a member using {$H+} in their code and claims Pascal is easy to read, ask them to use {$LONGSTRINGS ON} instead, just to be consistent. You can't hate count++ and use {$H+}. {$WRITEABLECONST} is just another funny Pascal readability issue. I don't know what it does to prevent errors/mistakes, but it almost proves that this is a missing part in the language itself, replaced with an abuse of a compiler directive. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$push}{$J+}...{$pop} ---------------------------------------------------------------------- Thaddy · 2018-05-09 03:48 Compiler directives are not necessarily part of the Pascal language. Strictly speaking they aren't. But cryptic syntax is always possible:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin write(^M^J^G);end. Now, how many of you remember what that does.? ---------------------------------------------------------------------- engkin · 2018-05-09 04:35 Quote from: Thaddy on May 09, 2018, 05:48:12 amCompiler directives are not necessarily part of the Pascal language. Strictly speaking they aren't. Yes, sure. They are not part of the language. Still practically the language can not be used without them.  Quote from: Thaddy on May 09, 2018, 05:48:12 amBut cryptic syntax is always possible:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin write(^M^J^G);end. Now, how many of you remember what that does.? Equivalent to #13#10#7. Quotethe caret character (^) can be used in combination with a letter to specify a character with ASCII value less than 27. Thus ^G equals #7 - G is the seventh letter in the alphabet. The compiler is rather sloppy about the characters it allows after the caret, but in general one should assume only letters. ---------------------------------------------------------------------- Thaddy · 2018-05-09 04:48 Quote from: engkin on May 09, 2018, 06:35:10 amEquivalent to #13#10#7. Equivalent to mechanical typewriter (return + bell). There's a difference, though. Technically the ^M syntax is - the only - true Pascal escape syntax whereas #13 syntax is simply byte representation of a char misused for escaping. (yes, I know, it has the same result but semantically that is the case  ) ---------------------------------------------------------------------- metis · 2018-05-11 10:05 @Handoko QuoteHave you read the link? Typed constant is not the constant that you thought.Yes, it is (sorry). I only have Internet-Access at my work place, where I cannot read all Posts, that came in the Meantime and then answer accordingly. So, I simply didn't see the Citation written in green and the Link below. @Handoko + Pascal + Thaddy Though I use typed Contants quite often, I never did within Routines. From now on, I will - Thanks for Your Hints. @Zoran QuoteHowever, the syntax is quite unfortunate.In my Opinion, as well, it's quite misleading to name something a "Constant", that is variable, even if it can be seen as "constant over calls" as Thaddy mentioned. (I also fell into that "Trap".) QuotePerhaps we should call these global variables with local scopeOr simply "static variables". QuoteI'd do it this way:It depends on how You define an "exact block" - I wouldn't call a Unit or the Program itself an "exact block". @lainz QuoteHe means in each scope. With your code you are creating a variable for all function scope, ...I actually meant in each scope in the Sense of being available anytime and anywhere in the Program. You pointed out another Issue. ---------------------------------------------------------------------- howardpc · 2018-05-11 11:20 Quote from: metis on May 11, 2018, 12:05:44 pm@Zoran QuoteHowever, the syntax is quite unfortunate.In my Opinion, as well, it's quite misleading to name something a "Constant", that is variable, even if it can be seen as "constant over calls" as Thaddy mentioned. (I also fell into that "Trap".) QuotePerhaps we should call these global variables with local scopeOr simply "static variables". AFAIK the "typed constant" description is nomenclature inherited from TP / early-Delphi times, we can't blame the FPC developers for that. Personally I prefer to call them "initialised variables". It is one of many areas where a multiplicity of overlapping terms is not particularly helpful, and probably confusing to newcomers. However, we cannot undo our history, or insist that others use some preferred or standard name. They used to be stored always in the data segment, not as part of the heap. Where does the compiler keep them these days? ---------------------------------------------------------------------- Zoran · 2018-05-11 11:32 Quote from: howardpc on May 11, 2018, 01:20:41 pmAFAIK the "typed constant" description is nomenclature inherited from TP / early-Delphi times, we can't blame the FPC developers for that. Yes, the unfortunate naming is Borland's fault. Quote from: howardpc on May 11, 2018, 01:20:41 pmPersonally I prefer to call them "initialised variables". But now whe have initialized variables which behave differently from typed consts, see: https://www.freepascal.org/docs- html/current/ref/refse24.html Unlike typed constants, local initialized varibles are initialized on each routine call (so, I guess they are on the stack, and typed constants are in global memory area). So, I wouldn't call typed constants "initialized variables", as "initialized variables" are something else. By the way, we can also notice that global initialized variables and global typed constants (with {$J+}) actually do behave quite same, they are probably implemented same in compiler. ---------------------------------------------------------------------- metis · 2018-05-11 12:29 @howardpc Quotewe can't blame the FPC developers for that.I didn't want to blame the FPC-Developers, but everything can be improved. ---------------------------------------------------------------------- Thaddy · 2018-05-11 14:41 Quote from: Zoran on May 11, 2018, 01:32:02 pmQuote from: howardpc on May 11, 2018, 01:20:41 pmAFAIK the "typed constant" description is nomenclature inherited from TP / early-Delphi times, we can't blame the FPC developers for that. Yes, the unfortunate naming is Borland's fault. No it is is not. Typed constants are not even unique to Pascal. To mention a few: several COBOL dialects, ADA and C++. For somebody that actually read the theory it is perfectly valid and logical naming. Typed vs Literal should be enough to understand it.. https://en.wikipedia.org/wiki/Constant_(computer_programming) ---------------------------------------------------------------------- marcov · 2018-05-11 14:44 Having true structured consts is important in embedded applications where it is backed by flash or placed in a non writable code segment rather than data. ---------------------------------------------------------------------- Zoran · 2018-05-11 15:04 Quote from: Thaddy on May 11, 2018, 04:41:00 pmQuote from: Zoran on May 11, 2018, 01:32:02 pmQuote from: howardpc on May 11, 2018, 01:20:41 pmAFAIK the "typed constant" description is nomenclature inherited from TP / early-Delphi times, we can't blame the FPC developers for that. Yes, the unfortunate naming is Borland's fault. No it is is not. Typed constants are not even unique to Pascal. To mention a few: several COBOL dialects, ADA and C++. For somebody that actually read the theory it is perfectly valid and logical naming. Typed vs Literal should be enough to understand it.. https://en.wikipedia.org/wiki/Constant_(computer_programming) No. I have no idea about ADA and COBOL, but the constants in C++ are constant, being typed is completely irrelevant, when declared as const, once initialized, they are not writeable. ---------------------------------------------------------------------- Thaddy · 2018-05-11 15:24 In C++ - depending on compiler settings - it is possible to change the value of a named constant within its scope. That is basically the same as Pascal. The big difference between const and named/typed const is memory allocation. Named consts and typed consts have an address.... ---------------------------------------------------------------------- snorkel · 2018-05-11 15:53 This is going to make me look super old, but I learned pascal back in college circa 1992, the University I went to had the core programming courses in pascal and then you took electives for other languages like C++ I used VB for awhile and it sucked and then Delphi came on the scene around 1995 and I immediately dropped VB like it was molten lava hahah. The best part is on windows you can still to this day make single file exes that just work, no stupid java or .net runtimes etc needed. I then dabbled with Lazarus and when it hit 1.0 in 2012 I ported everything I had to Lazarus and FPC and have not used Delphi since. The big corporations are consumed with web development even though it is the most insecure way to develop, I hate web development as it can be hacked in a heartbeat even if your careful and implement a CRSF token system etc. ---------------------------------------------------------------------- Zoran · 2018-05-11 16:06 Quote from: Thaddy on May 11, 2018, 05:24:07 pmIn C++ - depending on compiler settings - it is possible to change the value of a named constant within its scope. That is basically the same as Pascal. The big difference between const and named/typed const is memory allocation. Named consts and typed consts have an address.... You keep stressing the implementation detail (where and how these are stored internally), which is rarely important to the programmer. Yes, it is nice to know, but much more important for the programmer is to keep distinction between what can vary (a variable) and what is constant throughout its life within its scope (a constant). The much cleaner syntax would be to use the keyword var for what can vary, and reserve the const keyword for what cannot. This is a high level language after all. ---------------------------------------------------------------------- Thaddy · 2018-05-11 18:55 Zoran you miss the point for typed consts. It is actually a low-level construct that pre-dates Object Pascal and makes maintaining state - like fields of a class - between function.procedure calls possible. It is NOT a var! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {{$WRITEABLECONST ON}function countme:integer;const i:integer = 0;begin;  inc(i);  Result := i;end;var k:integer;begin  for k:= 0 to 9 do    writeln(countme);end.It is const in the sense that it is const, not writable, outside of the scope where it is declared. A var is reset every call. Nothing new, nothing to do with Pascal as such. It is quite a common concept in computer science, not only compiler design, but e.g. also functional design. There is already sufficient difference between a typed const and an untyped - really an inferred const which size is usually determined based on the CPU register size! - const. And even if writableconst is selected, it still is a memory location and NOT free for the compiler to substitute with a immediate constant value. Although optimization may choose otherwise when appropiate.. The latter is real implementation detail.... ---------------------------------------------------------------------- Zoran · 2018-05-11 20:29 Quote from: Thaddy on May 11, 2018, 08:55:00 pmZoran you miss the point for typed consts. It is actually a low-level construct that pre- dates Object Pascal and makes maintaining state - like fields of a class - between function.procedure calls possible. It is NOT a var! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {{$WRITEABLECONST ON}function countme:integer;const i:integer = 0;begin;  inc(i);  Result := i;end;var k:integer;begin  for k:= 0 to 9 do    writeln(countme);end.It is const in the sense that it is const, not writable, outside of the scope where it is declared. A var is reset every call. Nothing new, nothing to do with Pascal as such. It is quite a common concept in computer science, not only compiler design, but e.g. also functional design. There is already sufficient difference between a typed const and an untyped - really an inferred const which size is usually determined based on the CPU register size! - const. And even if writableconst is selected, it still is a memory location and NOT free for the compiler to substitute with a immediate constant value. Although optimization may choose otherwise when appropiate.. The latter is real implementation detail.... Okay... but still, other languages do treat it as a kind of a var, not const, don't they. At least C/C++ -- static variables, declared as other variables, without const, just static keyword). Nevertheless, I'll try to accept this explanation you gave. After all, that is the way it has been in Pascal syntax for decades, so I accepted it long time ago, and there is not much point in going on opposing you further (which always presents a risk with a grumpy old man who has too many times proven himself superior to the plebs of this forum ). ---------------------------------------------------------------------- metis · 2018-05-14 10:37 @ASBzone QuoteI also started learning C and C++...Nice languages, but nothing like Pascal for me... + For me, Pascal just happened to suit my personality, and has been quite capable of doing all that I have needed.Though I did not try out or even learn so many ProgrammingLanguages as You did (I'm a pure HobbyProgrammer - My Education and Profession has nothing to do with Programming, at all), I agree with You a 100%. I can read C/C++ w/o Problems, but I never felt any Stimulus to write a Programm with them. For me C/C++ is like "interesting, but strange", while Pascal is like being at Home. (really totally subjective Sentiment) @engkin Quoteit will be more like glorifying PascalNot necessarily, see here http://forum.lazarus- ide.org/index.php/topic,40803.msg285336.html#msg285336 -> What is missing in Pascal ? -> What can not be done with Pascal without "big Detours" ? (even if this Thread's Title is "Why Pascal?".) @snorkel QuoteI used VB for awhile and it sucked and then Delphi came...and I immediately dropped VB + I ported everything I had to Lazarus and FPC and have not used Delphi since.Same with me. @Zoran Quotebut much more important for the programmer is to keep distinction between what can vary...and what is constantYes. In General, so not only referring to ProgrammingIssues: Of course, the Theory is important, but the Practice should be kept user-friendly, otherwise People only get lost in Details, that are not important for every Day's Work, or more "programming-spoken": A Front-End should be comprehensive and easy to use, even if the User doesn't know every Detail of the Back-End. If somebody is interested in getting deeper into the Theorie behind, he may do so, but it should not be obligatory. -> Stil for me naming something (in the Front-End) a "Constant", that is actually variable, is misleading. Just imagine, what would happen, if every Lazarus- or Pascal-User should learn Assembler first. I suppose, even this Forum would be quite empty. ---------------------------------------------------------------------- Thaddy · 2018-05-14 13:38 No it would not be empty at all: Well there's a skew towards 45+ in age distribution, so yes, probably a majority has assembler knowledge. And indeed very few started with assembler but these old men switched soon to assembler to get around limitations and make the most of the hardware that was current for their personal use. Like Atari's, C64, BBC Micro, ZX80/81/spectrum and the likes. Just like these guys are all running at least one Raspberry Pi.... (Hardly using assembler for the ARM). I was quite happy to type in 7 pages of densely printed hexadecimals from a magazine to have my dose of gaming.... That's in theory, these 7 pages: I have not built in error correcting code like crc32....You'll learn it the hard way... ---------------------------------------------------------------------- metis · 2018-05-14 15:46 Once upon a Time, the biggest Problem in big Towns was the Pollution caused by the Quantity of Coaches drawn by Horses. Nowadays, big Towns still have the same Problems, but not because of Horses. ---------------------------------------------------------------------- Thaddy · 2018-05-14 16:24 Actually, nowadays horses are welcome in city centers because -while they pollute in a more visible way - their environmental footprint is less than a truck with a Diesel engine. Unless it is a German horse. In that case it needs re-testing..... ---------------------------------------------------------------------- metis · 2018-05-14 17:06 1. One Truck is equal to about 300-500 Horses. 2. I still prefer a fast, cosy car to a Horse. 3. I never liked Diesel. 4. Other Manufacturer like from Japan or Italy got the same Problem. (Have to leave my work place, sorry) ---------------------------------------------------------------------- marcov · 2018-05-14 18:29 Quote from: metis on May 14, 2018, 12:37:22 pm-> What is missing in Pascal ? Not much. I think the language suffers more from new extensions (whose applications are successively more rare, and orthogonality suffers). Moreover, new features are already introduced while the older never are really finished, and then I mean mainly the library part. Quote-> What can not be done with Pascal without "big Detours" ? (even if this Thread's Title is "Why Pascal?".) Barring things that Pascal is not a scripting language: not much. Of course "big" is subjective. But IMHO the problems, but also the reasons for me to use FPC/Lazarus are not in language. Once the language is sufficiently evolved enough, the attractions and problems are outside the language. One can navel gaze at infinitum on language features, but that doesn't solve anything. ---------------------------------------------------------------------- dbannon · 2018-05-15 00:19 Quote from: metis on May 14, 2018, 12:37:22 pmFor me C/C++ is like "interesting, but strange", while Pascal is like being at Home. (really totally subjective Sentiment) I once heard the transition from C to C++ as being like nailing extra legs onto a dog and calling it an octopus. And I agree, I once called myself a C programmer (yeah, in your dreams Davo) but could never handle the transition to C++, its object model just had too many things going on and you could never be sure you were seeing the big picture. On the other hand, the Pascal object model seems initially simple and manageable but still has a rich environment beyond that initial learning curve. And it suits (eg) LCL beautifully. Davo ---------------------------------------------------------------------- Thaddy · 2018-05-15 10:26 I found an actual picture of how C++ looks like: ---------------------------------------------------------------------- garlar27 · 2018-05-18 23:04 Quote from: Thaddy on May 15, 2018, 12:26:29 pmI found an actual picture of how C++ looks like: +1 ---------------------------------------------------------------------- Guser979 · 2021-08-29 18:06 Because if I'm not a programmer and I can produce tools that really help in my daily activities (and that's what interests me) using graphics, databases, communication, mobile-desktop integration and all that in an absurdly short time.... God. .. I wonder what a programmer can do.