* * *

Author Topic: [SOLVED] Verbosity...  (Read 3329 times)

engkin

  • Hero Member
  • *****
  • Posts: 2104
Re: [Feature Request] Verbosity...
« Reply #15 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:
  • You know VB.
  • You want to move to Pascal (FPC).
  • You like [a few cosmetic] modifications.

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.

Handoko

  • Hero Member
  • *****
  • Posts: 2578
  • My goal: build my own game engine using Lazarus
Re: [Feature Request] Verbosity...
« Reply #16 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.
« Last Edit: July 01, 2018, 06:25:35 pm by Handoko »

engkin

  • Hero Member
  • *****
  • Posts: 2104
Re: [Feature Request] Verbosity...
« Reply #17 on: July 01, 2018, 06:24:55 pm »
end without begin?

Handoko

  • Hero Member
  • *****
  • Posts: 2578
  • My goal: build my own game engine using Lazarus
Re: [Feature Request] Verbosity...
« Reply #18 on: July 01, 2018, 06:28:12 pm »
Yep.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6510
Re: [Feature Request] Verbosity...
« Reply #19 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.
« Last Edit: July 01, 2018, 07:30:34 pm by marcov »

GypsyPrince

  • New member
  • *
  • Posts: 34
Re: [Feature Request] Verbosity...
« Reply #20 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.
May the mass * acceleration be with you!

BSaidus

  • Full Member
  • ***
  • Posts: 229
  • lazarus 1.6.4 Win8.1 / cross FreeBSD
Re: [Feature Request] Verbosity...
« Reply #21 on: July 02, 2018, 08:28:00 am »
No,
We are in obj/Pascal world, not VB.
So ....
lazarus 1.6.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

MacWomble

  • New member
  • *
  • Posts: 22
Re: [Feature Request] Verbosity...
« Reply #22 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.
Mint 18.3 Cinnamon, Codetyphon 6.4 64Bit

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6510
Re: [Feature Request] Verbosity...
« Reply #23 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#).
 

RayoGlauco

  • Jr. Member
  • **
  • Posts: 78
  • Beers: 1567
Re: [Feature Request] Verbosity...
« Reply #24 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
« Last Edit: July 02, 2018, 12:16:32 pm by RayoGlauco »
To err is human, but to really mess things up, you need a computer.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6510
Re: [Feature Request] Verbosity...
« Reply #25 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.

GypsyPrince

  • New member
  • *
  • Posts: 34
Re: [Feature Request] Verbosity...
« Reply #26 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.
May the mass * acceleration be with you!

GypsyPrince

  • New member
  • *
  • Posts: 34
Re: [SOLVED] Verbosity...
« Reply #27 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
May the mass * acceleration be with you!

Handoko

  • Hero Member
  • *****
  • Posts: 2578
  • My goal: build my own game engine using Lazarus
Re: [SOLVED] Verbosity...
« Reply #28 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

GypsyPrince

  • New member
  • *
  • Posts: 34
Re: [SOLVED] Verbosity...
« Reply #29 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.
« Last Edit: July 03, 2018, 06:41:41 pm by GypsyPrince »
May the mass * acceleration be with you!

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus