Recent

Author Topic: Web Applications with Pascal  (Read 5512 times)

Nate897

  • Newbie
  • Posts: 5
Web Applications with Pascal
« on: April 24, 2024, 03:17:43 pm »
Hey guys  8) 

I recently considered using FPC for web services.

I found this interesting video on the Internet, and found it amusing, and I think it raises good points.

There ideas are expressed better than words. Basically it says that it sounds absurd to convert a lower-level, statically typed, etc. language to a higher level one, and that important strengths of Pascal are lost, and that some comparisons are nonsensical, among other things.

I think nobody got to answer my other topic and it was erased ? I don't understand. If it's really necessary I will remove the link. It is really harmless, not SPAM, any type of promotion or things like that. It speaks better than words, and is just about 5 minutes long.

What do you guys think about the subject? Please discuss.

1HuntnMan

  • Sr. Member
  • ****
  • Posts: 278
  • From Delphi 7 to Lazarus
    • NewFound Photo Art
Re: Web Applications with Pascal
« Reply #1 on: April 24, 2024, 06:44:00 pm »
Nate,
   In the past I've used PHP for developing web forms, etc.  We weren't designing a website we were working on an application with the data stored on a web server at the company. The company is just using the internet as the network.  Good idea, huh!
   I've been writing programs with pascal back to the Turbo Pascal days in the 1980's and love pascal.  But, haven't tried writing an app in Las/FPC for what we used PHP but, to me it's a similar endeavor and PHP looks similar to pascal code...

Handoko

  • Hero Member
  • *****
  • Posts: 5376
  • My goal: build my own game engine using Lazarus
Re: Web Applications with Pascal
« Reply #2 on: April 24, 2024, 08:56:29 pm »
@Nate897

If you're good in Pascal, you may want to try using FPC to build web services. If you're not good in Pascal, there are many other options available. If you like it, use it. If it works for you, keep using it.

If you want to try and learn more, here:
https://wiki.lazarus.freepascal.org/fcl-web
https://www.getlazarus.org/learn/tutorials/examples/webserver/
https://wiki.lazarus.freepascal.org/fpWeb_Tutorial

This is support forum for answering questions for users who have problem using Pascal. I wonder what kind of discussion you want to get.

Moderators, please lock this discussion or better delete it. This kind of discussion will start flames of war.

VisualLab

  • Hero Member
  • *****
  • Posts: 575
Re: Web Applications with Pascal
« Reply #3 on: April 25, 2024, 01:45:20 am »
Some kid troll decided to create a "buzz on the forum" by writing a primitive and clumsy taunt based on a garbage video recorded by some depressed person. The kid probably wanted to show off in front of his friends.

There are plenty of such garbage videos on YouTube. If Google improved its algorithms for filtering posted content, they would be able to:

- recover a lot of space by removing accumulated garbage,
- improve the image of your website (TikTok is used to collect garbage),

After weeding out the garbage on YouTube, people who compulsively watch videos there could feel appreciated that they are using a website for the intelligent part of the population :)

I support Handoko's position - the entry is garbage, clumsily prepared by some dimwitted teenage troll. He doesn't even know how to troll properly :)

egsuh

  • Hero Member
  • *****
  • Posts: 1491
Re: Web Applications with Pascal
« Reply #4 on: April 25, 2024, 03:49:52 am »
I have watched the video and my conclusion is that it does not deserve 5 seconds of your time.

Anyway, I have developed a web server with Lazarus, and its basic functions are database management and expression evaluation. Receiving requests and sending out response take relatively small parts of my whole program. And, HTML5 makes it much easier to do many things within the web-browser itself. I don't understand why people are comparing which language is better in developing web application, etc. It will depend on what functions the web server must do.

egsuh

  • Hero Member
  • *****
  • Posts: 1491
Re: Web Applications with Pascal
« Reply #5 on: April 25, 2024, 04:02:51 am »
BTW, I hope some component which emulate CSS file, which mean I edit properties of the component within Free Pascal, and the write text file to css so that it can be directly used by HTML file.

domasz

  • Hero Member
  • *****
  • Posts: 553
Re: Web Applications with Pascal
« Reply #6 on: April 25, 2024, 09:59:44 pm »
Basically it says that it sounds absurd to convert a lower-level, statically typed, etc. language to a higher level one,

PHP and Pascal are same level languages, way higher than C/C++ (which is just a lazy wrapper around assembly).
Most people will say PHP is C-like language but in reality PHP is very similar to Pascal.


Code: PHP  [Select][+][-]
  1. function Hello(int $a, int $b, string $c, string $d): string
  2. {
  3.    if ($a == 0 and $b == 0) return $c . $d;
  4. }

Code: Pascal  [Select][+][-]
  1. function Hello(a: Integer; b: Integer; c: String; d: String): String;
  2. begin
  3.  if (a = 0) and (b = 0) then result := c + d;
  4. end;


VisualLab

  • Hero Member
  • *****
  • Posts: 575
Re: Web Applications with Pascal
« Reply #7 on: April 26, 2024, 09:25:09 am »
PHP and Pascal are same level languages, way higher than C/C++ (which is just a lazy wrapper around assembly).
Most people will say PHP is C-like language but in reality PHP is very similar to Pascal.

It seems to me that this is too much of a simplification. So:

  • I would separate C from C++ and Pascal from Object Pascal (procedural vs object oriented).
  • C++ contains many mechanisms and solutions with both low and high abstraction. Similarly with Pascal and Object Pascal (this is a significant simplification).
  • Pascal and Object Pascal are compiled into machine code, while PHP is interpreted. This is significantly reflected in the source code.
  • Pascal and Object Pascal have a type system and their compilers enforce this quite strictly on the programmer - this is a huge advantage. There is no need to use a type system in PHP code (as is usually the case in most scripting languages) - this is a very serious drawback.
  • Pascal and Object Pascal requires declaring variables before use - this is also a huge advantage. There is no need to declare variables in PHP code (again, as is usually the case in most scripting languages) - this is also a very serious drawback.

These are just a few issues that immediately come to mind. Of course, these are truisms.

The differences between C and Pascal or C++ and Object Pascal (I group) are probably smaller than between Pascal and Object Pascal and languages such as: C#, Java, Kotlin, Go, JavaScript, Perl, PHP, Python, Ruby (II group).

Either way, in my opinion, the similarity between Pascal (or Object Pascal) and PHP is illusory and deceptive. It's as if someone said that a shark and an orca are very similar organisms. It is known that they are very different and their apparent external similarity is an effect of (biological) convergence. Maybe it's some kind of "IT convergence"?

Code: PHP  [Select][+][-]
  1. function Hello(int $a, int $b, string $c, string $d): string
  2. {
  3.    if ($a == 0 and $b == 0) return $c . $d;
  4. }

Code: Pascal  [Select][+][-]
  1. function Hello(a: Integer; b: Integer; c: String; d: String): String;
  2. begin
  3.  if (a = 0) and (b = 0) then result := c + d;
  4. end;

This is a very simple example. Additionally, it was deliberately written in such a way that these examples seemed similar. With larger portions of code, the differences are immediately visible. Just look at the classes in both languages and you can immediately see how different they are. For example, PHP does not have properties that are present in Object Pascal. I mention this on purpose because the word properties is used in the PHP documentation. But PHP doesn't have properties. Let's go gives: differences in the use of arrays, lack of structures in PHP, strange implementation of enum types added not so long ago in PHP. There is much more to it. To sum up: Object Pascal (especially Pasacal) is very different from PHP.

Nate897

  • Newbie
  • Posts: 5
Re: Web Applications with Pascal
« Reply #8 on: April 30, 2024, 03:11:16 pm »
Nate,
   In the past I've used PHP for developing web forms, etc.  We weren't designing a website we were working on an application with the data stored on a web server at the company. The company is just using the internet as the network.  Good idea, huh!
   I've been writing programs with pascal back to the Turbo Pascal days in the 1980's and love pascal.  But, haven't tried writing an app in Las/FPC for what we used PHP but, to me it's a similar endeavor and PHP looks similar to pascal code...

Thanks. I have used 'classic' PHP a few years ago. About PHP looking similar to Pascal, I think the opposite: it's like the Pascal language 'encourages' you to write better organized code - for example, declaring types, units and interfaces and such.
And I've seen Java and JSP, ASP dot net, and similar stuff, and thought about something like those existing for this language. Then, researching about it I found the pas2js library, and that gem I shared. Pascal's good structure, great performance ('pure' Pascal can be as fast as C), the FPC compiler, were some reasons why I considered it for server-side code. 


If you're good in Pascal, you may want to try using FPC to build web services. If you're not good in Pascal, there are many other options available. If you like it, use it. If it works for you, keep using it.

I wonder what kind of discussion you want to get.

I wanted to discuss exactly what I said. I noticed later that there's a section for web programming, maybe I should've posted there... but here should be fine I guess?
Your first sentence is pointless - I'm not asking about other options and I obviously like Pascal and want to use it.

Moderators, please lock this discussion or better delete it. This kind of discussion will start flames of war.

People like you make things bad, or worse if they're already bad. You would not be a good moderator acting this way. I put a small notice for the moderator who removed my previous topic. Did you not see that?
I don't see how a flame war could be initiated by Pascal users who like Pascal in a topic about Pascal.

The third link you gave (https://wiki.lazarus.freepascal.org/fpWeb_Tutorial) is really good, I appreciate it.

Some kid troll decided to create a "buzz on the forum" by writing a primitive and clumsy taunt based on a garbage video recorded by some depressed person. The kid probably wanted to show off in front of his friends.

I am not a kid. And what is said there about older users doesn't affect me, either -- I'm not what he calls a 'boomer' :). That aspect does come out as immature I think. Anyway, I found that video amusing and clever, while agreeing with the points given there. I summarized in a sentence those points in the first post.

I support Handoko's position - the entry is garbage, clumsily prepared by some dimwitted teenage troll. He doesn't even know how to troll properly :)

What I said to him above, applies to you as well. You're misunderstanding the topic, and I agree with your morose views about the Internet; it's in that state for a reason, and the solutions you proposed do not solve the root causes.
 
You come and insult me for no reason, saying my topic is garbage, should be deleted, etc. If I were a troll you two would be the ones feeding.  Something against what's said there, some valid arguments, instead of just name-calling?

I have watched the video and my conclusion is that it does not deserve 5 seconds of your time. 

I have watched it in its entirety and thought it was amusing while at the same time making valid points. Worth watching I say. Might give you a good laugh.

There is much more to it. To sum up: Object Pascal (especially Pasacal) is very different from PHP.

What you said is spot on. See? You made yourself comparisons of lower-level languages with interpreted ones.
This is the main point given in the video (albeit in a sarcastic way).
That converting Pascal, a statically-typed, imperative, verbose, language, to a higher-level dynamic, fundamentally different language, such as JavaScript, sounds absurd. I myself have never seen anything like that.
As you've mentioned a few languages, imagine, say, a C++ to Python converter. All the reasons to use C++ are lost. The only reason I can think of, is familiarity with the language. Then again, anyone who uses that language would have no difficulty learning the other one. To use such a converter to write large-scale applications would be absurd.
I have used C++ for server-side processing, and I think Pascal would be good for that purpose and not web browser applications.

And so I found that video, while looking for web development using Pascal, found valid points, despite the tone, and shared, asked opinions on the subject, and appreciated the given suggestion of an actual tutorial of how to use Pascal for HTTP server applications.

Is my dimwitted teenage troll clumsy taunt improved anyhow? 

VisualLab

  • Hero Member
  • *****
  • Posts: 575
Re: Web Applications with Pascal
« Reply #9 on: May 02, 2024, 08:58:29 pm »
Moderators, please lock this discussion or better delete it. This kind of discussion will start flames of war.
People like you make things bad, or worse if they're already bad. You would not be a good moderator acting this way. I put a small notice for the moderator who removed my previous topic. Did you not see that?

Handoko is very tolerant and helpful to people asking questions on this forum. So you are wrong on this point.

I don't see how a flame war could be initiated by Pascal users who like Pascal in a topic about Pascal.

What flame war? What do you mean?

Some kid troll decided to create a "buzz on the forum" by writing a primitive and clumsy taunt based on a garbage video recorded by some depressed person. The kid probably wanted to show off in front of his friends.

I am not a kid. And what is said there about older users doesn't affect me, either -- I'm not what he calls a 'boomer' :). That aspect does come out as immature I think. Anyway, I found that video amusing and clever, while agreeing with the points given there. I summarized in a sentence those points in the first post.

Maybe you're not a child. It does not matter. Your post was worded as children (teens) tend to do. "Boomers" usually have seen more in their lives, so they quickly and easily pick out such "gems" :)

The video is neither clever nor funny. It is a typical naive, inept "supposed-meme" in the form of a video. The way it is prepared makes it impossible to take it seriously. The topic of the movie doesn't matter. If the text inserted into the video referred to any other field of knowledge, it would still be rated poorly.

I support Handoko's position - the entry is garbage, clumsily prepared by some dimwitted teenage troll. He doesn't even know how to troll properly :)

What I said to him above, applies to you as well. You're misunderstanding the topic, and I agree with your morose views about the Internet; it's in that state for a reason, and the solutions you proposed do not solve the root causes.
 
You come and insult me for no reason, saying my topic is garbage, should be deleted, etc. If I were a troll you two would be the ones feeding.  Something against what's said there, some valid arguments, instead of just name-calling?

Once again - your post doesn't contribute anything and the video is a typical mocking and naive "freak". "Boomers" (from this and other forums) have seen thousands of such videos, so they are not impressed by it (at most, they are irritated by its incompetence and stupid form).

If you wanted to share any observations or comments on the forum, you had to describe them in a neat, sensible and clear way. Posting links to "funny" videos is perceived by participants as cluttering the forum with "bullshit". What is the conclusion from all this? Avoid writing content that is typical of teenagers. Regardless of whether you are 30, 60 or 90 years old ;)

I have watched the video and my conclusion is that it does not deserve 5 seconds of your time. 

I have watched it in its entirety and thought it was amusing while at the same time making valid points. Worth watching I say. Might give you a good laugh.

Again - I do not share your opinion about the mentioned video. Form definitely matters. It's about credibility, the way of transmitting, and the readability of the content. Why didn't you provide a link to a well-prepared recording on the topic you are interested in? I'm sure Youtube has quite a few of them.

There is much more to it. To sum up: Object Pascal (especially Pasacal) is very different from PHP.

What you said is spot on. See? You made yourself comparisons of lower-level languages with interpreted ones.
This is the main point given in the video (albeit in a sarcastic way).
That converting Pascal, a statically-typed, imperative, verbose, language, to a higher-level dynamic, fundamentally different language, such as JavaScript, sounds absurd. I myself have never seen anything like that.
As you've mentioned a few languages, imagine, say, a C++ to Python converter. All the reasons to use C++ are lost. The only reason I can think of, is familiarity with the language. Then again, anyone who uses that language would have no difficulty learning the other one. To use such a converter to write large-scale applications would be absurd.
I have used C++ for server-side processing, and I think Pascal would be good for that purpose and not web browser applications.

And so I found that video, while looking for web development using Pascal, found valid points, despite the tone, and shared, asked opinions on the subject, and appreciated the given suggestion of an actual tutorial of how to use Pascal for HTTP server applications.

Is my dimwitted teenage troll clumsy taunt improved anyhow?

And couldn't you have written from the beginning like in the paragraph above? If you had included a well-prepared video, it would certainly result in a substantive discussion.

People on the forum judge posts based on their content, not the intentions of their author. It's almost like a compiler: it transforms the source code into machine code based on what the programmer wrote, not what he wanted to achieve :)

Nate897

  • Newbie
  • Posts: 5
Re: Web Applications with Pascal
« Reply #10 on: May 10, 2024, 06:06:15 pm »
Handoko is very tolerant and helpful to people asking questions on this forum. So you are wrong on this point.

He just suggested to lock or remove what he doesn't like. If he were a moderator, he probably would have just deleted it straight away. That's not what a good moderator does.

What flame war? What do you mean?

He said that above.

he video is neither clever nor funny. It is a typical naive, inept "supposed-meme" in the form of a video. The way it is prepared makes it impossible to take it seriously. The topic of the movie doesn't matter. If the text inserted into the video referred to any other field of knowledge, it would still be rated poorly.

Again - I do not share your opinion about the mentioned video. Form definitely matters. It's about credibility, the way of transmitting, and the readability of the content.

It's clever and funny. Clever, because there valid points are raised, using subtitles on a foreign-language video that has nothing to do with the subject. You're just annoyed by its tone. That's the point of that video obviously, to mock an absurd thing. As I said it expresses ideas better than words do. The video is not inappropriate in any way; the people getting "offended" by it have, so far, in this topic, been calling names. See how it worked?

Once again - your post doesn't contribute anything and the video is a typical mocking and naive "freak". "Boomers" (from this and other forums) have seen thousands of such videos, so they are not impressed by it (at most, they are irritated by its incompetence and stupid form).

Once again, you're doing nothing but calling names; and, grandpa, you're making this about age groups again. You're speaking for yourself, regarding this part.

Anyway. To be frank, I agree that that library is a huge waste of effort. So is its usage. Moreover, it makes absolutely no sense to have project types for extensions and packages to some third-party editors in Lazarus. To think otherwise is irrational. Hopefully they will fix that soon. :)

Handoko

  • Hero Member
  • *****
  • Posts: 5376
  • My goal: build my own game engine using Lazarus
Re: Web Applications with Pascal
« Reply #11 on: May 10, 2024, 06:25:39 pm »
I am sorry, I thought you was the troll who recently visiting the forum with the intention to cause flame of war.

It seems you care about Lazarus/Pascal. You mentioned fixing it, if you found any bug please submit a bug report:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues

zamronypj

  • Full Member
  • ***
  • Posts: 138
    • Fano Framework, Free Pascal web application framework
Re: Web Applications with Pascal
« Reply #12 on: May 10, 2024, 11:37:59 pm »
author of the video does not understand it very well about Pas2Js

I think the goal is to be able to write front-end side code in Pascal because  most Internet browsers supports JavaScript. Pas2js is not meant for server-side web application.
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Apache module executes Pascal program like scripting language https://zamronypj.github.io/mod_pascal/
Github https://github.com/zamronypj

PierceNg

  • Sr. Member
  • ****
  • Posts: 394
    • SamadhiWeb
Re: Web Applications with Pascal
« Reply #13 on: May 11, 2024, 03:26:25 am »
I think the goal is to be able to write front-end side code in Pascal because  most Internet browsers supports JavaScript. Pas2js is not meant for server-side web application.

"In the cloud" pas2js could work server-side too. Cloud service providers tend to supply SDKs for the usual languages like Java, C#, Go and JS/TS. Good support in pas2js for TS type definitions makes it possible to use the JS/TS SDK through automatic code generation to "consume" (can't stand this word here) cloud services in Pascal, e.g. by implementing a webhook server in pas2js. The alternative approach is to generate Pascal bindings from OpenAPI or gRPC specifications of said cloud services, but here Free Pascal doesn't have a good story.

Anyway. To be frank, I agree that that library is a huge waste of effort. So is its usage. Moreover, it makes absolutely no sense to have project types for extensions and packages to some third-party editors in Lazarus. To think otherwise is irrational. Hopefully they will fix that soon. :)

"huge waste of effort", "absolutely no sense", "irrational". These are just statements of opinion. The video doesn't mention anything substantial against pas2js either. El Risitas* just "speaks" a bunch of facts about pas2js and launches his signature laugh.

* Spanish Laughing Guy / "El Risitas" Interview Parodies

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: Web Applications with Pascal
« Reply #14 on: May 11, 2024, 08:33:42 am »
author of the video does not understand it very well about Pas2Js

I think the goal is to be able to write front-end side code in Pascal because  most Internet browsers supports JavaScript. Pas2js is not meant for server-side web application.
Well, who is the one that does not understand pas2js very well?
node.js is a server side scripting engine and pas2js explicitly supports it. That is just one example where you are wrong.
https://nodejs.org/en

Note that it doesn't only run in the cloud: any server can support it (as do mine);
« Last Edit: May 11, 2024, 08:51:03 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

 

TinyPortal © 2005-2018