Chaosforge Forum

General => Off Topic => Topic started by: Titt on July 06, 2008, 10:53

Title: Free Pascal
Post by: Titt on July 06, 2008, 10:53
As far as I know, all of Kornel's roguelike projects are written in Free Pascal. I have always heard serious programmers talk about Pascal as being sort of a "toy" language, like BASIC, but I assumed Kornel was just most familiar with Pascal so it was most comfortable and effective for him to use it. So it surprised me to see that Free Pascal does very well in the programming language benchmarks shootout. Here (http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=gcc&lang2=fpascal) is its comparison to gcc, the GNU C compiler, one of the tightest compilers for any language, ever, and Free Pascal does only marginally worse on CPU time for most benchmarks, and noticeably better on memory use. Weighing CPU time, memory use, and program size with equal weights, Free Pascal does better than all other compilers in all other languages (http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=calculate&xfullcpu=1&xmem=1&xloc=1&binarytrees=1&chameneosredux=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1&threadring=1).

These benchmarks are highly artificial and definitely don't take into account many (perhaps most) of the factors that are important in programming, but it still was a surprise to me, to see Free Pascal perform so well. Kornel, what do you use to write graphics to the screen in your roguelike projects? Is there something like curses available for Free Pascal?
Title: Re: Free Pascal
Post by: ParaSait on July 06, 2008, 13:10
So if I understand right, a freeware compiler is way better than a paid compiler? Weird...
Title: Re: Free Pascal
Post by: rekenne on July 07, 2008, 01:16
This is not a terribly odd thing, really.
Title: Re: Free Pascal
Post by: Rabiat on July 07, 2008, 02:19
I don't see why Pascal would be considered a toy language by anyone who could be seen as a 'serious' programmer (whatever that is).

Also, I don't think there's a strict relation between the quality of a compiler and the language it parses.
Title: Re: Free Pascal
Post by: Jim9137 on August 27, 2008, 07:43
When people say "pascal is a toy" they usual refer to Turbo Pascal and other such relics from 80s.

Damn stoned junkie programmers, I DO NOT WANT.
Title: Re: Free Pascal
Post by: Igor Savin on August 28, 2008, 03:31
/Kornel, what do you use to write graphics to the screen in your roguelike projects? Is there something like curses available for Free Pascal?/

Carefully written, hand-crafted output library, which rocks. It's part of Valkyrie - give it a shot; input-processing libraries are good too.

The only bad thing: current Valkyrie is not compatible with recent FPC 2.2.2, and I wonder if Kornel has plans for update at all.
Title: Re: Free Pascal
Post by: Rabiat on August 28, 2008, 09:08
When people say "pascal is a toy" they usual refer to Turbo Pascal and other such relics from 80s.

Just 'cause Turbo Pascal is old doesn't make it a toy. But I guess many programmers were introduced to programming through Pascal, and all they remember is the toy programs they wrote in it when they were noobs. Then again, Turbo Pascal never did have a standard library to speak of, which made it extremely time-consuming to create anything non-trivial in it. I don't know anything about compiler construction, but as far as I remember Borland's implementation was supposed to be decent enough in its day (as well as their C/C++ compilers).

Quote
Damn stoned junkie programmers, I DO NOT WANT.

You don't want... what, exactly? The hallucinogenics must be blocking my ability to read your mind. ;)

Carefully written, hand-crafted output library, which rocks. It's part of Valkyrie - give it a shot; input-processing libraries are good too.

FreePascal still implements the good old CRT unit, but I've been browsing parts of Valkyrie and it has a lot to offer. I think using Valkyrie could cut a roguelike's development time in half. Unfortunately, half the fun of writing a roguelike is creating my own field of view code, input processing, and display routines, and then abandoning the project for two years, because I can't come up with solid content for the life of me. ;)
Title: Re: Free Pascal
Post by: Igor Savin on August 29, 2008, 00:59
/FreePascal still implements the good old CRT unit/

With a difference. Default CRT output refreshes screen on every possible output done, which is awfully inefficient, slow and flickery-prone.

Valkyrie ouput is more Curses-like in this sense, as you can control, when to update the screen - which is mostly unneeded, since latest (SVN) Valkyrie uses progressive aproach to this problem - screen is updated every time player is expected to press a key, which is a rational thing to do; and should you need updates in between, you can call these easily.