Re: [fpc-other] What makes a Compiler project (like FPC) special?
2017-05-25 21:29 GMT+02:00 Graeme Geldenhuys: > On 2017-05-25 19:47, Nikolay Nikolov wrote: > So what is Florian going on about regarding workflow and Git not being able > to cope in a "compiler" based project? He made it out as if FPC will not be > workable in a Git managed environment. I don't see his analogy. The Linux > Kernel running on more platforms than FPC does, is just as complex a beast, > if not more - considering that the Linux Kernel probably has 10's of > millions of lines of code, 2000+ contributors. The same could be said for > the KDE and Qt framework. The latter runs on just about every platform out > there, as multiple rendering engines, font engines, theme engines, layout > engines etc. The workflow of the Linux kernel would simply not be acceptable for us with them having this hierarchy of maintainers with Linus at the top and doing all the final merging. If at all an approach like Qt uses with automatic continous integration of pull requests committed by core devs or forwarded by them from non-core devs would be the way to go for us - if at all. Regards, Sven ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] Felipe: Java and multi-threading
Hi Felipe, > This simple program never ends if you delete the volatile keyword (I > tested here in Windows): Yes, I got the same behaviour as you, using Java 1.8 under FreeBSD. But I immediately saw your problem. You are accessing the same data from more than one thread. That has always been a big NO-NO in any programming language. Using the synchronized code blocks to protect the common data or actions being executed I get this as output. [threads]$ java FelipeTestThread Thread 2 finishing Thread 1 finished. Counted up to 2205390 [threads]$ It works, just like it does when the "volatile" keyword is used. Attached is the corrected version of your sample application without the volatile keyword. It is worth noting that using volatile is faster, but also has its limits (ie: you can't protect a whole block of code or actions). But the bottom line is, you tried to access common data from multiple threads, without trying to protect that data. Not the way to go! Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp class FelipeTestThread { //volatile keyword not needed any more private boolean running = true; public void test() { // thread 1 new Thread(new Runnable() { public void run() { int counter = 0; while (isRunning()) { counter++; } System.out.println("Thread 1 finished. Counted up to " + counter); } }).start(); // thread 2 new Thread(new Runnable() { public void run() { // Sleep for a bit so that thread 1 has a chance to start try { Thread.sleep(100); } catch (InterruptedException ignored) { // do nothing } System.out.println("Thread 2 finishing"); //running = false; stopRunning(); } }).start(); } public static void main(String[] args) { new FelipeTestThread().test(); } public void stopRunning() { synchronized(this) { running = false; } } public boolean isRunning() { synchronized(this) { return (running == true); } } } ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] Felipe: Java and multi-threading
On 2017-05-26 15:56, Graeme Geldenhuys wrote: Attached is the corrected version of your sample application without the volatile keyword. It is worth noting that using volatile is faster, but also has its limits (ie: you can't protect a whole block of code or actions). To add to this, there is also a memory access effect between volatile and synchronize. For a detailed explanation, take a look the marked "correct answer" in this StackOverflow topic: https://stackoverflow.com/questions/3519664/difference-between-volatile-and-synchronized-in-java Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] How do you keep up with FPC discussions?
On 5/26/2017 4:36 AM, wkitt...@windstream.net wrote: > > hahaha... nope... just experienced readers of messages who have > learned how to work through them fairly quickly and easily... i will > grant that it does take an hour or two... if i'm offering someone some > help and have to go write code, i do that over several days... even if > it means skipping some reading a day or two... And on top of that, experienced enough to use a proper email client, with proper message filtering, instead of (ab)using a web browser just just another task... ;-) Ralf --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] How do you keep up with FPC discussions?
On 2017-05-26 10:27, Ralf Quint wrote: On 5/26/2017 4:36 AM, wkitt...@windstream.net wrote: hahaha... nope... just experienced readers of messages who have learned how to work through them fairly quickly and easily... i will grant that it does take an hour or two... if i'm offering someone some help and have to go write code, i do that over several days... even if it means skipping some reading a day or two... And on top of that, experienced enough to use a proper email client, with proper message filtering, instead of (ab)using a web browser just just another task... ;-) Ralf Indeed I hate web based programs of all kinds, but, after lots of my email clients corrupted their databases which were not in plain text and I lost my emails, I started using web servers and web programs as email clients for lots of email. Thunderbird was an option, as AFAIR you could store email as plain text, which is easier to recover if there is a failure, but thunderbird, was bloated and took up way too much memory. Sylpheed claws was another one I was interested in, as it had one of the most advanced "Rule" system to automate tasks. More advanced than any I could find.. it has changed names to claws-mail However, IMO it has nothing to do with filtering out email because you still have to read the email lists and read through emails no matter how much you filter things. It's not like you can magically guess that "all emails regarding anything to do with VARARGS I want to delete" because 2 months later you may need varargs help. Or, it's not like you can magically guess that you don't want any emails coming in that have anything to do with fixed arrays, because you don't use fixed arrays - but maybe you will in 2 months! Setting up thousands of filters is a time waster too... But, this does bring me back to the sylpheed claws exploration days when I was really into automating email rules using advanced filtering/rulesets. I don't use them much any more but I used to use them like crazy ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] How do you keep up with FPC discussions?
On 2017-05-25 06:10, Mark Morgan Lloyd wrote: On 25/05/17 10:20, Graeme Geldenhuys wrote: On 2017-05-25 09:02, Mark Morgan Lloyd wrote:> even if most of the time he> pushes it far harder than many of us enjoy. I’m afraid it’s an occupational habit. My job as a technical consultant and developer often requires me to come up with more efficient ways of doing things. Yes, inefficient ways and code really grind on me. I’ll try my best not to push this any further here. I /am/ trying to be neutral on this, but I think it has pretty much been done to death here: particularly since Florian has given his ruling. Well if we want to come up with an efficient way of doing things, it's possible that Git and SVN are both not the answer to development model. The answer may be to start up a campus, similar to microsoft campus, with multiple buildings and developers that can literally knock on each others door when needing assistance :-) i.e. freepascal becomes a campus... with social eating events in the campus at lunch. But that would require funding and relocating of all developers, and, even in a campus you'd probably still use svn/git anyway :-) ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] How do you keep up with FPC discussions?
On 5/26/2017 6:25 PM, nore...@z505.com wrote: > > Indeed I hate web based programs of all kinds, but, after lots of my > email clients corrupted their databases which were not in plain text > and I lost my emails, I started using web servers and web programs as > email clients for lots of email. Thunderbird was an option, as AFAIR > you could store email as plain text, which is easier to recover if > there is a failure, but thunderbird, was bloated and took up way too > much memory. I am using Thunderbird, on Windows 7/8.1/10, macOS and Linux Mint Mate for several years now, ever since I had due to a move switch away from my old desktop running Eudora as the email client and use a laptop instead. And it has the benefit now that it runs on all three main OS that I use every day. And that is using 6 different email addresses (right now, one specifically for ), all using IMAP for ages now. And compared to the amount of memory you are using in a web browser to get even close to the comforts you get with a real email client, it is rather "lean and mean"... > > However, IMO it has nothing to do with filtering out email because you > still have to read the email lists and read through emails no matter > how much you filter things. It's not like you can magically guess that > "all emails regarding anything to do with VARARGS I want to delete" > because 2 months later you may need varargs help. Or, it's not like > you can magically guess that you don't want any emails coming in that > have anything to do with fixed arrays, because you don't use fixed > arrays - but maybe you will in 2 months! > Then you do not understand how you can apply filtering. You can mark threads you are not interested in as "read on arrival", or depending on the subject, move them in logical subfolders where you can read them as needed. Likewise, you can mark "hot topics" with a tag, having them show up not only a new/unread, but with certain colors. You can filter not only on subject but also on sender (for better or worse ;-) ), text occurring in the body, etc... This way, you can have the computer do the most tedious part, separating "signal from noise", which largely helps to reduce the number of emails you actually "have to read". For me, that is on average maybe 10-20% of the daily emails. And why do you want to delete any emails, unless they are complete and utter nonsense/spam (which barely happens in any of the FPC mailing lists at least)?. I have all emails from the FPC lists going back to early 2013, when I got by previous laptop and switched some accounts from POP3 to IMAP, and it would just take a restore from some old backup to get any previous emails back, probably at least to 2002 or so. And if you are looking for a certain topic/keyword from past posts, you can do a search just fine, which you might have to do anyway if you are looking for something in a past thread, as I seriously doubt that you remember exactly where and when someone posted that info you might be looking for a few months later... > Setting up thousands of filters is a time waster too... Pick you poison... But, as far as setting up filters goes, most of it is a one time thing. It might be a bit more if you just get started, but it will reduce and become second nature over time if you keep using it, saving you a lot of time in the long run. And TBird does filters much better than any other email client out there right now, I barely miss Eudora these days anymore... Ralf --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] What makes a Compiler project (like FPC) special?
Graeme Geldenhuys asked in Vol 108, Issue 27, "What makes a compiler project special?" Well, I'm not a member of the FPC but I've worked on several compilers and I'll throw in my 0.02 Euro into the discussion. > Since Florian mentioned that a compiler project is "rocket science" [not his > direct words, but he hinted at that] and totally different to any other > software > project... It has really bugged me... Why is it different, and What is > different? I'm going to have to disagree here, and it may simply display my own ignorance of the subject, but, then again, even a stopped clock is right twice a day. A compiler is a "language processor," an application that converts code in one language into something else. If it's a translating compiler it converts it to another language. If it's a language compiler it converts it to binary code or potentially to assembly language. (I'm making a bit of a distinction in that a compiler that translates to assembly code isn't a "translator" because it is using the assembler to save some of the work in not "reinventing the wheel" and not having to create its own object file writer, and because compilers generating assembly are usually creating a finished output requiring no manual intervention. Most translators that change source from one (high level) language to another produce results that often require manual correction. Few translators produce "perfect" high-level to high-level conversions without some work. They'll do the "heavy lifting" but often minor "tweaks" or checking is required by the person.) At its core, a language processor is a text processing application. It takes a fixed combination of rules on what the programmer can and must "say" in order to specify the particular actions they want a program to accomplish. Given these rules, which are called "grammars" the programmer describes the program and the compiler takes that description and turns it into the target representation of that description. In the case of a translator, it produces a new program in a different language. Or it may be the same language but converted to a different dialect, such as a translation from a different Pascal compiler, or a conversion from HP Cobol to IBM Mainframe Cobol, or conversion from C or Fortran to something newer. Most language processors have gone to using parser generators in order to reduce the work involved in scanning a source language. Some may simply do language scanning directly. Most older Pascal compilers used "symbol substitution" in which as the language was scanned, it would create a symbol identifying what had been found. Whether it was an unrecognized word (which would indicate a user identifier), a symbol (like :, >, /, comma, etc) or a keyword (USES, UNIT, BEGIN, etc). Then the internal "current symbol" was set to the value of that symbol. Most compilers had about a 1 byte lookahead so that it could determine if it was a single byte symbol (comma, ^, or ' ) or a multibyte symbol which may be different depending on the second byte (> followed by an identifier vs. >=, : vs :=, < vs <> or <=). Okay, all of this was reasonable until object orientation came into use. When one uses a variable, or a constant, which one are you using? Well, it depends on the "scope." If you have I defined in the main program (or in the definitions of a UNIT), your reference is to that one. If you're inside a procedure, function, method or other similar construct and you define I there, it uses that one/ But what if your program - or UNIT - calls several others UNITs each having a variable I defined, which one does it use? The first one? The last one? Now, the plot thickens if you reference an object. An identifier in that object can be fixed or virtual. In which case, it may not be certain until execution time which one is being used, a variable or procedure in the base class or an overridden one in a descendant object. So a compiler has to read the tables in a unit in order to discover what items are visible and where they are in that unit, also to know what kind of variable (or procedure, or function) it is, and what is legal to do with it (can't add a 64-bit integer to an 8-bit unsigned byte because they're not compatible but you can do it the other way around.) But this is still the translation of symbols and assigning them attributes including whether they are a standalone item (like a unit), a dependent item (like a variable in a program) or an internal item (like a field in a record or a member of an object.) It requires you keep information about these things but I don't think this is any worse than the work involved in a video game in holding state information about the game map, the player character (PC), non-player characters (NPCs), enemies, objects the player can hold (guns, Portal Device, radio) or the use or consume (money, ammo, health). The last time I did a compile of the full compiler, it
Re: [fpc-other] What makes a Compiler project (like FPC) special?
On 2017-05-25 16:04, mar...@stack.nl wrote: But Florian's statements just bugged me, and I see no proof to convince me otherwise - a compiler is just a complex project. Nothing "special" as he claimed it to be. I do think Nikolay's point of it being more interconnected describes it fairly well. There are no narrow interfaces that are natural seams for modularization inside the compiler. I've always wanted to modularize the fpc compiler in such a way that you could use the fpc compiler for not just compilation, but checking/parsing the code for other reasons, i.e. fpdoc. But this would likely make the compiler slower. And another modular compiler idea is that you could embed a relational database language inside fpc as a plugin, such as SQL or TutorialD, but these are just pipe dreams - and a plugin/modular compiler likely will be slower to compile code since there are now more things the compiler has to choose to do, more wrappers. But, I don't know for certain. There was also that strange, but rejected, object oriented plugin compiler that someone was working on at one time.. Was it Dodi? I forget his name. Maybe the delphi decompiler guy? ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] What makes a Compiler project (like FPC) special?
On 2017-05-25 16:21, Nikolay Nikolov wrote: On 05/26/2017 12:16 AM, Graeme Geldenhuys wrote: On 2017-05-25 22:04, Marco van de Voort wrote: There are no narrow interfaces that are natural seams for modularization inside the compiler. Yet the “packages” and “rtl” directories is just that - which by the way is part of the FPC project. "packages" - yes. But "rtl" is a lot more tightly coupled to the "compiler" than you think. Indeed, all the string routines and reference counting is tied to the compiler. I learned this when I had an idea for a new string type.. A string(1000) instead of string(255) or a string(arbitrary). Fixed length string that can go beyond 255. Oberon has it. When you introduce a new type into the RTL that is not a class, but a type that is part of the language itself you have to add all the routines in sysutils to deal with this type, change the compiler, make overloaded string routines. And system.pp is tightly intertwined with the compiler and is almost a run time for the language. Not as much like Plain C, but probably even Plain C has some connections to the include files and the compiler Then there is writeln too which is tied to the compiler as it is like a varargs, but accepts multiple types. So if you introduce a new string(1000) into the compiler, writeln also has to be modified to accept this new type as a parameter. But not just writeln, other things too. If you don't have this intertwined and tightly integrated system you just end up putting things into a Lisp like system where it is all defined by not the compiler/rtl, but the libraries/modules which changes the language at run time. Powerful but also double edged sword that makes the language redefinable - open for abuse and misuse, such as lisp's ability to basically rechange the entire language to any thing you want as long as you include (some(brackets)) but everything else is up for grabs. ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
Re: [fpc-other] What makes a Compiler project (like FPC) special?
Am 25.05.2017 um 16:18 schrieb Graeme Geldenhuys: > This is directed at Florian primarily, but any other FPC core member is > welcome to chip in. > > different to any other software project... It has really bugged me... > Why is it different, and What is different? Because they are basically a mess of spaghetti code and modules :) And this is not the writers fault but simply their nature, they are a very complex piece of software were everything is inter winded. In theory, everything sounds simple: one has a front end consisting of a scanner and a parser and a back end consisting of an optimizer, a code generator and an assembler. Front end and back end are accessing the symbol tables. However, in practice things look different. We try to keep fpc layered and everything, nevertheless, the unit dependency graph looks terrible, see attachment (resized, I can send a full fledged pdf if someone is interested). Simple things often mean that one has to dig upside down and one is often bitten by several side effects or interferences of changes. I am really familiar with the code of FPC, but I do not want to know the hours I spent in e.g. r36325 (which is basically 100 lines of new code, rest is copy and moving code around) due to such effects. Code sample for the "spaghetti" nature, just look at the needtemp function in fpc/compiler/ncal.pas at line 4589: it determines if an argument of an inlined subroutine needs to be copied to a temp. The code is commented very well, it is almost literate programming, everything is split into multiple if statements, nevertheless it is very unreadable. Of course, EveryIfStatmentCouldBeMovedToAnExtraFunctionWithADescribtiveLongName, but I doubt that it makes it more readable in the sense of being understandable. ___ fpc-other maillist - fpc-other@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other