Lazarus

Free Pascal => FPC development => Topic started by: GypsyPrince on July 01, 2018, 12:00:14 am

Title: [SOLVED] Verbosity...
Post by: GypsyPrince on July 01, 2018, 12:00:14 am
1.) Can FPC expand the main program block entry point and terminator?

Current:
----------------
Begin
    // Put program code here...
End.


Proposed:
----------------
Function Main(): Integer;
Begin
    // Put program code here...
End Main.

And frankly, I'd also be happy if the "Begin" statement was just completely removed.

2.) One reason I am working to transition from Visual Basic .NET (as well as C and C++) to Lazarus is that Lazarus matches closely VB in its verbosity. Is there any possibility that we can take it just a little bit further with the "End" statements?

Every structure block is terminated with the "end;" statement.

Can FPC extend the to include the block type of which they are terminating?

Examples:
-------------------------------------
End Function;
End Procedure;
End If;
End Try;
End Case;

etc.

"While-do", "Repeat-until", and "For-do" loop structures should all terminate with "End Loop;".

In large tutorial examples I've seen containing several nested blocks, it is difficult to determine which "End;" terminator goes with which structure block.

Again, I'd be happy if the "Begin" statement was just completely removed.

I like verbosity. It forces the programmer to make fewer mistakes.

Is this a doable thing... at least as an option whereby programmers who like the current way can still use only the "End;" terminator?

This is just a wish. If these two ideas have already been pondered and rejected, I'll understand.

Thanx!
Title: Re: [Feature Request] Verbosity...
Post by: RAW on July 01, 2018, 01:05:05 am
First thought: WTF ???
Second: It's open source... you can do with it whatever you like [almost]...    :)
Title: Re: [Feature Request] Verbosity...
Post by: Phil on July 01, 2018, 02:04:39 am
This is just a wish. If these two ideas have already been pondered and rejected, I'll understand.

Not sure why anyone would want _more_ verbosity, since Pascal is already quite verbose, but if you prefer that syntax, you might want to stay with VB.NET. You do realized that VB.NET is cross-platform, right? Mono on Mac and Linux has always included a VB.NET compiler and Microsoft's free and relatively new IDE, Visual Studio for Mac, now includes Microsoft's VB.NET compiler (vbc) as well as the older Mono compiler (vbnc).

If you want to learn Pascal but retain a bit of the flavor of VB, you can always include the missing keyword as a comment, eg,

function HeyThere : Boolean;
begin
end;  {function}

Although I think repeating the name of the function makes more sense:

end;  {HeyThere}

For keeping track of begin/end, just make sure you indent properly. Maybe the tutorial you looked at wasn't indented quite right.
Title: Re: [Feature Request] Verbosity...
Post by: GypsyPrince on July 01, 2018, 03:09:27 am
Phil ~
1.) I no longer want to use the .NET or Mono frameworks, both of which are just virtual machines. I want native code.
2.) I asked if there was a way to make the extra verbosity OPTIONAL. If you don't like a feature, don't use it. And don't question someone else wanting to use it/ Life is really simpler that way.

RAW ~
I don't yet have the skill in Pascal to do what I want with the language/compiler.
If I ever win the lottery, the first thing I buy will not be a large house or exotic car. Instead, I while hire a team to develop an open source language, IDE, and compiler for me. It will be something similar to Visual Basic and Pascal having a baby... LOL
Title: Re: [Feature Request] Verbosity...
Post by: ASBzone on July 01, 2018, 06:01:18 am

Can FPC extend the to include the block type of which they are terminating?

Examples:
-------------------------------------
End Function;
End Procedure;
End If;
End Try;
End Case;

etc.

"While-do", "Repeat-until", and "For-do" loop structures should all terminate with "End Loop;".


It is kind of ironic to see you (rightfully) condemn programming language bashing in one thread (https://forum.lazarus.freepascal.org/index.php/topic,41633.msg290118.html#msg290118), but pursue the "hey, let's see some changes in this language that I have not gotten familiar with as yet" in this thread.   :D    Not quite the same as bashing, but comes pretty close.

In any event, I would suggest using comments for increased verbosity.   Of course, the compiler is not going to aid you in any way with these, but you could pursue the following effective immediately.

End {Function};
End {Procedure};
End {If};
End {Try};
End {Case};

Modula-2, Oberon and Oberon-2 -- which are Pascalish languages (or, more accurately, Wirthian languages) -- do support the following:

PROCEDURE SomeName
...
END SomeName


https://www.modula2.org/reference/proceduredeclarations.php (https://www.modula2.org/reference/proceduredeclarations.php)
https://www.inf.ethz.ch/personal/wirth/Oberon/Oberon07.Report.pdf (https://www.inf.ethz.ch/personal/wirth/Oberon/Oberon07.Report.pdf)
https://en.wikipedia.org/wiki/Oberon-2#Syntax (https://en.wikipedia.org/wiki/Oberon-2#Syntax)


But Pascal itself doesn't.   You could still use the same technique above (i.e. END {SomeName};) although the Lazarus IDE helps keep you straight on which procedure or function you are in, especially if you look at the various UI options.
Title: Re: [Feature Request] Verbosity...
Post by: GypsyPrince on July 01, 2018, 06:17:23 am
"It is kind of ironic to see you (rightfully) condemn programming language bashing in one thread, but pursue the "hey, let's see some changes in this language that I have not gotten familiar with as yet" in this thread.   :D    Not quite the same as bashing, but comes pretty close."

Soooooooo... you think asking for an option, not a complete change, but an option to do something a different way while leaving the ability for others to keep doing it the current way comes even remotely close to "bashing" said language? Wow! What a grasp of the English language because the English I learned in school - the two concepts come nowhere even close to being related. But keep on with that if it makes you feel better.

Like I told the other guy, if you don't like the feature. just don't use it. That way it doesn't affect you. And if it doesn't affect you, then it's none of your business. See how simple life is. Now, if I wanted to remove an existing feature that you happen to like, then you might have proper cause to chime in with your opinion. But in this case... not so much. Don't like a feature request, don't use it. But don't bash someone else asking for it or tell them they'd be better off doing it this way or that. Since you're not a developer of Lazarus, my guess is the request wasn't directed at you, and again, not your place to chime in.
Title: Re: [Feature Request] Verbosity...
Post by: Thaddy on July 01, 2018, 08:39:08 am
Well, how about:
Code: Pascal  [Select][+][-]
  1. {$macro on}{$Define End_Function:=end}{$Define End_Procedure:=End}
  2. {$Define End_If := End}{$Define End_Try:= End}{$Define End_Case := End}
  3. procedure testme;
  4. var i integer = 0;
  5. begin
  6.   if true then
  7.     case i of
  8.     1:;
  9.     2:;
  10.     3:;
  11.     end_case;
  12.   end_if;
  13. end_procedure;
  14. begin
  15. end.
Note that would be only you using it....This is not VB. A.k.a. VerBose
Title: Re: [Feature Request] Verbosity...
Post by: Handoko on July 01, 2018, 08:52:28 am
What about:

Code: Pascal  [Select][+][-]
  1. procedure testme;
  2. begin
  3.   if true then
  4.     case integer of
  5.     a:;
  6.     b:;
  7.     c:;
  8.     end; // case
  9.   end; // if
  10. end; // procedure
  11.  
  12. begin
  13. end.
Title: Re: [Feature Request] Verbosity...
Post by: GypsyPrince on July 01, 2018, 10:17:35 am
Part of my thinking here (or lack thereof, really LOL) is that as Microsoft decreases its development of Visual Basic, there will be a lot of VB users looking for a replacement.  So far, Delphi and Lazarus are the closest equivalents to VB as far as its features vs. its ease of use. Other supposed VB alternatives I've tried just don't even come close to what VB, Lazarus, or Delphi can do. I was just thinking that, the option for syntax a bit more similar to VB's might go a long way to attract those users to Lazarus/Free Pascal. You'd already win them over with the functionality and features in Lazarus, which they'd naturally learn as they go. But as perception is reality, it is the syntax that always gives new users performance anxiety, fills them with doubts, and frightens them away from a new language.  I used to be young and quick to learn. But now I'm old, feeble, and slow on the uptake. So, I learn better and faster with things which are at least a bit familiar to me. Because familiarity makes me feel more comfortable on the surface, I become more curious about other unfamiliar aspects and features of the language and begin to dabble with them.  Free Pascal shouldn't be a syntactic VB clone, by any means. It would just be nice if it were a bit more similar is all I'm saying. So far, it's proving to be a bad-ass development environment.
Title: Re: [Feature Request] Verbosity...
Post by: marcov on July 01, 2018, 02:46:23 pm
1.) Can FPC expand the main program block entry point and terminator?

No. Personally I don't see any benefit in this, other than removing one identifier (Main) from the usable identifier space.

And frankly, I'd also be happy if the "Begin" statement was just completely removed.

Can FPC extend the to include the block type of which they are terminating?

(and END becoming mandatory) Me too, but then it is no longer Pascal, but closer to Modula2.

Quote
2.) One reason I am working to transition from Visual Basic .NET to Lazarus is that Lazarus matches VB in its verbosity. Is there any possibility that we can take it just a little bit further with the "End" statements?

I'd like it, but only for the END function/procedure statements. Major mistakes in the block structure are more likely to be detected and localized at such END xxx point. Doing it for other statements too is fine, but should be voluntary, not mandatory. In many cases you don't want it since it hampers refactoring. 

Modula2 (Pascal's successor) required to end with the function name, so

Code: [Select]
PROCEDURE SOME;
BEGIN
END 'SOME';

And while that was useful in some far fetched cases with nested procedures, in practice it was an enormous strain on refactoring. Though I assume nowadays with IDE identifier rename this should be a bit less.

Quote
"While-do", "Repeat-until", and "For-do" loop structures should all terminate with "End Loop;".

Then I would go for Modula2, where everything but straight for is a LOOP..END with a manual IF  THEN EXIT as terminator

In large tutorial examples I've seen containing several nested blocks, it is difficult to determine which "End;" terminator goes with which structure block.

Indenting, IDE tools there is even a setting to give the various levels a different colour (not perfect, but can help).
I use that, strangely enough, with Verilog. My Pascal usually is never insanely nested.

But this is all in some hypothetical case where we would start over with a new language. We are PASCAL, and we are backwards compatible with enormous codebases in both pure pascal and Delphi. Minor rearrangements that break code or splitting in radically different dialects mode is just not worth it. I would abolish OBJFPC if I had the chance
Title: Re: [Feature Request] Verbosity...
Post by: kupferstecher on July 01, 2018, 03:40:29 pm
Minor rearrangements that break code or splitting in radically different dialects mode is just not worth it. I would abolish OBJFPC if I had the chance
How are the compile modes realized? Do they have their own units, are there ifdef -orgies or... ?
Title: Re: [Feature Request] Verbosity...
Post by: marcov on July 01, 2018, 03:46:16 pm
How are the compile modes realized? Do they have their own units, are there ifdef-orgies or... ?

Afaik the modes are partially implemented by differing initialization of the parser for the given module, and a collection/set of suboptions that are tested with IF's yes (but since multiple modes can define same suboptions, you only need one test).

Mode objfpc is mostly different in generics and the @ for procedure variables.
Title: Re: [Feature Request] Verbosity...
Post by: kupferstecher on July 01, 2018, 03:55:55 pm
OK, thanks!
Title: Re: [Feature Request] Verbosity...
Post by: ASBzone on July 01, 2018, 05:10:08 pm
Since you're not a developer of Lazarus, my guess is the request wasn't directed at you, and again, not your place to chime in.

You asked a question on a publicly accessible forum.  It's anyone's place to chime in that is a member of that forum.

No one has stopped you from asking for new features.  It is just ironic that you would wax eloquent about the individual virtues of various programming languages, and then without getting even moderately up to speed on FreePascal, you see to change it to something more familiar.  No-one has deprived you of your freedom to make feature requests, and you can likewise deny no one their freedom to comment on said requests.

And, in fact, I offered you a suggested solution to your request -- one which you could implement today.

Thaddy's response is admittedly cooler, and supported by the compiler, too.
Title: Re: [Feature Request] Verbosity...
Post by: GypsyPrince on July 01, 2018, 05:36:00 pm
marcov ~

That is a lot of useful info, as well as a thorough explanation of why my request should not be implemented.
Title: Re: [Feature Request] Verbosity...
Post by: engkin on July 01, 2018, 05:41:18 pm
It will be something similar to Visual Basic and Pascal having a baby... LOL

LOL, I don't think you need to wait until you win the lottery. Logically:

If non of the above suggested ideas suits you, I would suggest that you consider developing your own source code to source code compiler using the language you know, VB, to give you the modifications you like.

In fact there are members that like to replace BEGIN/END with C style { / }, and even want to have, instead of i := i + 1, i++ and ++i. I suspect that there is a member here that is using this idea already. I saw enough samples of his code highly probable to be machine generated.

On the other hand, the core FPC developers have limited time and a long to-do list. I doubt they would be interested in adding your requested feature.

Finally, when your caret is at a BEGIN/END, try CTRL+Q then O. This should move you to the other side of the block. And welcome to Pascal.
Title: Re: [Feature Request] Verbosity...
Post by: Handoko on July 01, 2018, 06:14:26 pm
I can understand why TS want Pascal to be similar to VB. When I moved from BASIC to Pascal, I also wanted Pascal to be similar to BASIC. But after I'd been learning Pascal for weeks, I have no problem with it. It needs time to adapt to new things.

Well, I'm not here to argue about the Pascal style. I'm more interested with the code Thaddy posted recently. Can anybody tell me is it a bug? Why line #13 need to be removed?

I figured out myself. Here is the fix of Thaddy's code:

Code: Pascal  [Select][+][-]
  1. {$macro on}{$Define End_Function:=end}{$Define End_Procedure:=End}
  2. {$Define End_If := End}{$Define End_Try:= End}{$Define End_Case := End}
  3. procedure testme;
  4. var i: integer = 0;
  5. begin
  6.   if true then
  7.     case i of
  8.     1:;
  9.     2:;
  10.     3:;
  11.     end_case;
  12. //end_if;  <--- this line need to be removed, because the if block doesn't use begin
  13.  end_procedure;
  14. begin
  15. end.

Note:
Thaddy's solution seems to work but it has problem. Users can mistakenly use different end(_if/_case/_procedure). It happens because the compiler think they're all the same. For example, in the line above instead of removing line #12, you can remove line #13 and the compiler will be happy to compile without error.
Title: Re: [Feature Request] Verbosity...
Post by: engkin on July 01, 2018, 06:24:55 pm
end without begin?
Title: Re: [Feature Request] Verbosity...
Post by: Handoko on July 01, 2018, 06:28:12 pm
Yep.
Title: Re: [Feature Request] Verbosity...
Post by: marcov on July 01, 2018, 07:27:36 pm
Personally I think he is looking in the wrong direction.

Some superficial syntax similarities won't make porting any easier, a better  way to get a good quality VB programmers cross over is to have compatible libraries and frameworks that ease porting for major classes of VB(or VB.NET) applications.

Discussions like this are always obsessed with the most minute language details, with "familiarity" as some magic buzzword. If you are porting a million line VB.NET application, you can have the conversion tool strip off the IF from "END IF", you don't need to add it to Pascal.
Title: Re: [Feature Request] Verbosity...
Post by: GypsyPrince on July 02, 2018, 03:02:51 am
engkin~
 
Nah, I'd be better off waiting to win the lottery. Developing a complete language with IDE and compiler capable of producing commercial and enterprise level applications would be a titanic project for which I just don't have the experience and I am too old to learn it. My experience is mainly with custom databases. I don't have even the least bit of knowledge of how a compiler works or how to develop one. I don't know anything about parsers either. So, while the likelihood is thin that I might ever win a lottery and hire a team to develop my dream language, it's still a more realistic probability than my ever being able to develop it on my own. LOL
 
I was dabbling with the idea of an intermediary translator to convert VB language to object pascal before compilation. But again, that would require coding beyond my realm of expertise.

I have no idea why someone doesn't write a native cross-platform compiler for Visual Basic. I looked into MonoDevelop but a.) it uses a bloated platform/virtual machine similar to .NET and compiles to intermediate language rather than native code. b.) the project doesn't produce binaries for Windows, even though it does for Mac and Linux. In my attempt to compile the binaries, I had to follow numerous steps, install crappy frameworks I'll never use, and still could not get the source code to compile.
 
I don't know... when Microsoft does finally drop VB I probably just drop programming altogether.
Title: Re: [Feature Request] Verbosity...
Post by: BSaidus on July 02, 2018, 08:28:00 am
No,
We are in obj/Pascal world, not VB.
So ....
Title: Re: [Feature Request] Verbosity...
Post by: MacWomble on July 02, 2018, 08:34:20 am
I think you should use proper indenting for a good readability.
Also there is an option (in editor preferences) to use outlines and colors in the source-code. I personally like that.
There is no need of end_xxx in my opinion.
Title: Re: [Feature Request] Verbosity...
Post by: marcov on July 02, 2018, 09:23:25 am
I have no idea why someone doesn't write a native cross-platform compiler for Visual Basic. I looked into MonoDevelop but a.) it uses a bloated platform/virtual machine similar to .NET and compiles to intermediate language rather than native code. b.) the project doesn't produce binaries for Windows, even though it does for Mac and Linux. In my attempt to compile the binaries, I had to follow numerous steps, install crappy frameworks I'll never use, and still could not get the source code to compile.

I already was surprised by there not being such a successor for VB6. That was at the point the most popular development tool there was. Somehow the VB crowd is very inactive, seems the able persons, if any, move on with Microsoft's recommendations (first VB.NET, now C#).
 
Title: Re: [Feature Request] Verbosity...
Post by: RayoGlauco on July 02, 2018, 12:07:08 pm
I use the IDE options to mark code blocks, and I can see clearly where each block begins and ends. Good indentation also required!
(see attached images)
edit: don't try to find any sense in my example code!  ;D
Title: Re: [Feature Request] Verbosity...
Post by: marcov on July 02, 2018, 12:15:04 pm
I use the IDE options to mark code blocks, and I can see clearly where each block begins and ends. Good indentation
also required!

The colours requiring indentation being the main problem here. As said I use this option, but it's basically a visualization of the indentation in color, and not the structure.
Title: Re: [Feature Request] Verbosity...
Post by: GypsyPrince on July 02, 2018, 02:38:45 pm
marcov~

I do use C# when the client calls for it. However, I am retiring from coding for a living and now only want to work on personal projects. My goal here is to get away from the .NET framework and away from Microsoft products all together. I don't like intermediate languages or virtual machines, and I want my personal projects to only be native code. So, C# is not an option. However, because VB is my favored RAD environment, I'm of course looking for something that is comparable to it in both power and ease of use, but which also is cross-platform and compiles to native code. I've looked and Xojo. It's kinda close, but it doesn't fit my needs either.
Title: Re: [SOLVED] Verbosity...
Post by: GypsyPrince on July 03, 2018, 04:17:43 pm
RayoGlauco & marcov ~

Yesterday I discovered how to use Lazarus' colored outlines. They are very helpful. I would prefer the keyword remains the color they are supposed to on only the lines be colored. But they helpful, none the less. LOL
Title: Re: [SOLVED] Verbosity...
Post by: Handoko on July 03, 2018, 04:26:14 pm
Lazarus IDE has a lot of 'secrets'. Here are some (with animated pictures):
http://wiki.lazarus.freepascal.org/New_IDE_features_since
Title: Re: [SOLVED] Verbosity...
Post by: GypsyPrince on July 03, 2018, 05:46:44 pm
Handoko ~

Interesting features!
I'm waiting impatiently for the new Lazarus handbook to be published. They seem to keep putting it off. LOL

I need one last cheat question to help me get started. Then, I pretty much need to keep my face in the documentation to learn Pascal.
Title: Re: [SOLVED] Verbosity...
Post by: Handoko on July 03, 2018, 07:00:17 pm
I remember you asked about combining console mode with ShowMessage. Not sure on Windows, but this code below seems to work on my Linux computer:

Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   Interfaces, Dialogs;
  7.  
  8. begin
  9.   if ParamStr(1) = 'hello' then
  10.     ShowMessage('Hello, there!')
  11.   else
  12.     WriteLn('Unknown parameter.');
  13. end.

Note:
You have to add LCL as the project's required package.

The code is inspired from Thaddy, read here if you want to know more:
http://forum.lazarus.freepascal.org/index.php/topic,37425.msg251457.html#msg251457
Title: Re: [SOLVED] Verbosity...
Post by: GypsyPrince on July 03, 2018, 09:13:22 pm
Handoko ~

Thank you for your effort.

After reading a bit further in the documentation I found that graphic dialogs can be shown from console apps for Mac, Unix, and Linux, but not for Windows. However, the reverse can occur. One can open a console window from within a GUI app in Windows.

Also, and I actually like this better, while reading through my book 'Lazarus: The Complete Guide', I found that Lazarus can work with text-based GUI libraries such as "ncurses" for Unix and Linux, and for Windows - a library called Free Vision - derived from Turbo Vision that was the GUI library for Borland's Turbo C++ and Turbo Pascal. I'm doing my happy dance after finding out that bit of info.

Ah... Turbo C++. Fond memories. I miss DOS. LOL
Title: Re: [SOLVED] Verbosity...
Post by: GypsyPrince on July 03, 2018, 09:22:58 pm
Well, now. I performed a search and found that marcov has dabbled a bit with Free Vision.

marcov - were you ever able to get Free Vision to work with Lazarus in any meaningful way? Did anyone come up with a viable editor for it?

I am very nostalgic for old DOS programs and want to dabble a bit with FV in console apps.
Title: Re: [SOLVED] Verbosity...
Post by: marcov on July 03, 2018, 10:00:22 pm
Well, now. I performed a search and found that marcov has dabbled a bit with Free Vision.

Yes. Textmode IDE maintenance mostly.

Quote
marcov - were you ever able to get Free Vision to work with Lazarus in any meaningful way? Did anyone come up with a viable editor for it?

IF you mean a lazarus based designer, no, didn't even try, too little time.

Quote
I am very nostalgic for old DOS programs and want to dabble a bit with FV in console apps.

FV  old TP object model and ways of dealing with strings are a bit of a pain.
Title: Re: [SOLVED] Verbosity...
Post by: GypsyPrince on July 03, 2018, 10:43:42 pm
Ah. Oh well. Twas a good pipe dream while it lasted. LOL
Title: Re: [SOLVED] Verbosity...
Post by: GypsyPrince on September 14, 2019, 09:21:45 am
@marcov

Revisiting this almost a year and a half later...
I am in total agreement with you. Replacing 'End;' with 'End Procedure;', 'End Function;', etc. should not be mandatory. I was just pondering something more along the lines of a feature where one could create a list of aliases for keywords similar to pointer aliases in C, and type aliases in Kotlin. When the program is compiled, each alias would be replaced with the real keyword it represents.
 
Now... having said this, I don't think, at all, that this should be a feature built into Lazarus/FreePascal. Instead, I prefer it be some sort of add-on or package that would be loaded only when those more comfortable with VB syntax choose to load it. That way, Lazarus/Pascal purists don't have to deal with it if they don't want to. Basically, it would be an add-on that when the coder runs the 'compile' command' it would convert only the most basic of VB-like syntax into its proper Pascal syntax in temp files before the compiler actually executes and compiles those temp files.

Example:
If the coder typed  "End Procedure;", "End Function;", "End Try;", etc., each instance would be replaced simply with "End;" right before being compiled. Yes, the coder would still need to terminate the keyword aliases with a semi colon where one is required.

I certainly don't want to change the Pascal language into the VB language. I just want to make it a little bit more familiar and comfortable for VB users by aliasing a few basic keywords while we lure them over and they learn Pascal.

A major con to this, and it is a major one, is that such an undertaking require a small team of experienced volunteer coders to create such an add-on, and doing so without bothering either the Lazarus or FPC development teams. It would also be very tricky to make the converter work correctly and I myself do not have anywhere near the experience to take on that kind of project. So, I know this won't ever be a reality. But like I said before... t'was a nice pipe dream. LOL
 
To the folks who get upset at such a prospect and say "This isn't VB, it's Pascal."... is the purpose of either Lazarus or this forum to prove how much of a fanboy you are by viciously defending your chosen language, or is it about providing users with an open, powerful, productive development environment?
 
Someone mentioned that if I am more comfortable with the VB syntax then I should stay with VB. In addition to my losing faith in Microsoft's business and software sunset decisions, I have other reasons for wanting to drop VB/.NET.

1. VB/C#/.NET is compiled to CIL and runs on a virtual machine. It just can't deliver the performance I like getting when I use C/C++ - Pascal can.

2. Though VB is moving to cross platform, only console apps will be cross-platform, even in the upcoming .NET Core 3.0. GUI apps using WinForms and WPF will remain Windows only. Any Xamarin support for VB to allow for cross-platform GUI apps will be implemented only by opensource volunteers and won't be supported (officially, anyway) or promoted by Microsoft.

3. VB/C#/.NET applications are bloated and app portability is difficult without compiling to native code which can currently only be done with apps created on the Universal Windows Platform.

So, this is a chance for Lazarus to steal away the multitudes of folks like myself who are looking to jump the Microsoft and Windows ship.
Title: Re: [Feature Request] Verbosity...
Post by: glorfin on October 28, 2019, 03:57:36 pm
Well, how about:
Code: Pascal  [Select][+][-]
  1. {$macro on}{$Define End_Function:=end}{$Define End_Procedure:=End}
  2. {$Define End_If := End}{$Define End_Try:= End}{$Define End_Case := End}
  3. [/quote]
  4.  
  5. This is not quite the same as to have really different ends for for each construct, because in the latter case compiler would be able to help finding mismatches. Personally I like how it works in fortran, where no "begin" is needed, but "end"s are specific.
  6. Having said this, I think, adding this feature would draw us too far from pascal language. In case of really complex constructs, I am using simply comments, as was here supposed several times.
Title: Re: [SOLVED] Verbosity...
Post by: avra on October 28, 2019, 06:12:31 pm
If the coder typed  "End Procedure;", "End Function;", "End Try;", etc., each instance would be replaced simply with "End;" right before being compiled.
That's exactly what Thaddy has shown you how to do with use of macros. The only difference is using underscore instead of space. It is also debugger friendly, unlike preprocessor that you would prefer to see as an IDE plugin.

You might be interested in some VB to Delphi convertors, which can produce pascal code you can use in Lazarus as a start:
http://www.marcocantu.com/tools/vb2delphi.htm
https://cc.embarcadero.com/item/17064
http://www.vbto.net/

Do not expect miracles on complex projects. Lot of manual work will be needed. I used such converters just as time savers when there was a VB header for some C DLL when Pascal header didn't exist. It gives mostly 100% automatic conversion of VB DLL headers.
Title: Re: [SOLVED] Verbosity...
Post by: GypsyPrince on November 03, 2019, 10:18:31 am
@avra

Thank you for that info. However, I finally decided it is time for me to put on my "big boy" pants and use the language as was intended. It never really occurred to me before that "End" really isn't any different than using the closing curly bracket in C "}". I've been using that for decades, now. So, I guess I can stop being a cry-baby and use End without complaint, as well. LOL  :-[
TinyPortal © 2005-2018