Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
FPC development / Re: Case statement does not handle all possible cases
« Last post by nanobit on Today at 03:45:53 am »
I think it was TP that introduced the else-clause and the possibility of a fall-through/bypassed case-statement. For Delphi-compatibility the FPC adopted this malpractice. Pascal is very well designed and there are reasons why all possible case-labels have to appear in case-statements.

For exactness it should be noted here that "else" in FPC has a different meaning than "else" in Delphi, C++, C#.
The latter languages implement "all other values of underlying type", FPC implements only "all other defined values".
https://bugs.freepascal.org/view.php?id=36983
2
General / Re: It has a little bug in IDE
« Last post by y.ivanov on Today at 02:53:55 am »
@440bx
Well, let's argue whether to put a semicolon in C as follows {{};};
I'm bailing out of this...

Good point. It is written in the subject: it is about the IDE.
Maybe it must be discussed elsewhere.

I'd throw in a couple of related points before this discussion completely winds down. First, at least some of the ALGOL implementations describe anything after END as being an implicit comment, with minimal consideration of the status of ; in that context. Second, the END. at the end of an ALGOL (hence Pascal) program was a non-standard "hack" from Burroughs that allowed the compiler to decide that it had seen enough without reading the next card which would potentially have screwed up the remainder of the batch job (and their compilers insist that nothing follow it).

I've spent a bit of time over the last few weeks looking at Verilog and VHDL, and it's an interesting exercise speculating which bits are unarguably ALGOL, which bits are unarguably Ada, and which bits are probably Ada but the sub-sub-sub-committee had their own idea about the END behaviour and didn't agree with the guys in the next office :-)

Mark, thanks for sharing this. I'm personally very curious about such a first-person views on a computers development (and this is with the utmost respect). The time the computers came in my country, or I came into computers, it was about ~10 years gap from the IT developed (western) countries. That was the time for the engineers to reverse engineer the  IBM/360, VAX PDP-8, VME, etc. The clones were declared as genuine, the others were not mentioned at all.
So, I'm now truly interested in that unknown (for me) development. Languages as ALGOL, MPL, even COBOL - these are lost, skipped for me. But, as it turns out, every one of these has its implications on what we do now.

As I previously said, maybe it is a subject for a separate discussion.
3
General / Re: Adding a Laz-built program to Ubuntu Favorites?
« Last post by dbannon on Today at 02:34:14 am »
You don't mention which desktop you are using, you question is really a "Desktop Question".

If using the default Gnome (yek !) desktop and you want it to appear in the dock, typically down the left side, open the app in question, its icon appears in the dock, right click the icon and choose add to favourite.

If using one of the other desktops such as Mate, open the menu, right click the entry for the app in question and choose "pin to favourite".

If these don't work, you need to ask the Desktop people, its not a Lazarus issue I am afraid.

Davo
4
Spanish / Re: pregunta sobre liberacion de clases
« Last post by 440bx on Today at 01:46:57 am »
¡NUNCA LLAMÉIS AL MÉTODO DESTROY!
never use big red letters
5
I checked this with a copy of the transations demo in the examples folder of the Lazarus installation, and it worked partly: The strings which were directly assigned to translated strings were correct, but those handled by the LCLTranslator were translated only once and stayed at the language of the first translation. (With .po files all texts of the demo are translated).

I had recreated all .mo files, and then I moved the .po files out of the "languages" folder to simulate your situation - note that the .pot file must be removed as well because it makes the translation system think that there are .po files. Note also that the .pot file was automatically recreated when I recompiled the project - I could prohibit this in my test by unchecking the "Create/update .po file when saving a .lfm file" in the i18n options (however, this is not a good selection in development).
6
General / Adding a Laz-built program to Ubuntu Favorites?
« Last post by QEnnay on Today at 12:16:40 am »
Hi, I am leaving Mint (Upgrade crashed -- again) and installed Ubuntu 20.04.xx.

I have five programs I wrote with Lazarus and want to install them into the Ubuntu "Favorites" list on the Left side of the screen.

I installed Alacarte (menu manager) and added them in as new Items and they showed up in the "All" page. I click them and they launch fine, but there is no option to lock to the Favorites on the Left.

I did some searching and it was suggested to try making .desktop files and put them in the /usr/share/applications Folder and I did so. They too then showed up in the main "All" page, but none of them offered an "Add to favorites" option.

Currently back with Mint. Not sure if it is a Lazarus-build issue or a Ubuntu quirk, but thought I'd start here as the Alacarte install shows up with a "Add to favorites," option.
7
Glad I achieved that.  :)

I fixed the line order depending on the OS to make it simpler to render.

Yep also saw the raw stride on other occasions.
8
General / Re: It has a little bug in IDE
« Last post by 440bx on Today at 12:02:34 am »
And BTW, the "end" is perfectly valid to follow "begin".
Yes, it is and the reason has nothing to do with semicolons, it has everything to do with the fact that Pascal accepts whitespace (or a comment) as a null statement (incidentally, just as C does but, in C if whitespace is used as a null statement then the null statement must be terminated just like any other statement)

No. "end" is definitely not a delimiter. It is a terminal symbol which stands at the end of the <compound statement> rule (and some others too).
It's a "delimiter" in the sense that it marks the end of a compound statement (unfortunately, among other things.) 

I see. You named it (as separator, terminator) according to when it appears to be between or at the end of the "list".
This isn't just a choice I made.  C uses semicolons as a statement terminator whereas Pascal uses it as a statement separator.  In strict Pascal (the original McCoy) the last statement in a compound statement cannot be followed by a semicolon because if the compiler sees a semicolon it expects a keyword (or identifier) that starts another statement.  That is not the case in C.  In C, the last statement in a compound statement {...} must be ended by a semicolon just like any other statement because it explicitly marks the end of the statement.

This definition { statement ";" } will introduce ambiguity which changes grammar to LL(k). This is why you can't parse C grammar with a (naive) recursive descent parser.
It wouldn't.  It definitely would not cause the grammar to change to LL(k).  For the record, Pascal cannot be parsed with a "naive" recursive descent parser either (at least not strictly based on its grammar.)

Consider the following simple example: the if statement is being parsed, after the "then" token the if_rule procedure has called the statement_rule procedure.
In that case the compiler expects a _simple_ statement.

The statement_rule procedure returns consuming the semicolon. Now what to expect?
It must expect, either another statement (that is a new statement not part of the "if") or an "end" keyword that terminates a compound statement (or a procedure/function block.)

Another semicolon because "if" is also a statement (and must be terminated)? "else" because there is an else clause? or some other statement?  You can't tell for sure that the current if_rule is completed or not. You must take a decision and eventually to backtrack if it was wrong.
No, there is no need for multiple semicolons.  if multiple semicolons appeared then they would either be separators between null statements (as in Pascal) or null statement terminators (as in C.)

9
Does nobody have any suggestions as to why this isn't working?

Is there any extra info I can give that might help someone to help me with this?

The documentation clearly says that only .no files should be distributed with an application, but I have found that translations just don't work unless I include the .po files.

-FM
10
General / Re: It has a little bug in IDE
« Last post by MarkMLl on June 19, 2021, 11:43:21 pm »
Consider the following simple example: the if statement is being parsed, after the "then" token the if_rule procedure has called the statement_rule procedure.  The statement_rule procedure returns consuming the semicolon. Now what to expect? Another semicolon because "if" is also a statement (and must be terminated)? "else" because there is an else clause? or some other statement?  You can't tell for sure that the current if_rule is completed or not. You must take a decision and eventually to backtrack if it was wrong.


ifSt = 'IF' expression 'THEN' .OUT('DUP' '0') .OUT('BRF' *1)
        statementSeq .LABEL *1
        ifElsePart 'END';

ifElsePart = ('ELSE' .OUT('BRT' *1) statementSeq .LABEL *1) |
        (.EMPTY .OUT('STO' '__undefined__'));

(* If statement. Note that care is required to make sure that the   *)
(* stack is consistent whether or not there is an else part.      *)


That's Meta-2 notation which you're probably unfamiliar with (Schorre, 1964), but basically "it just works" if you look for "else..." | nothing. My company's running on that code.

MarkMLl
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018