PDA

View Full Version : Free Pascal 2.1.4 Released



WILL
22-05-2007, 01:01 AM
Just yesterday the FPC Team has released the 2.1.4 version of their cross-platform compiler. They are dubbing this one the release candidate for version 2.2.0, which will be released in about 2 months time.

The purpose of this release is to get user feedback and bug reports from everyone that can pitch in to make it as stable as possible for the final 2.2.0 release. So the more that participate, the better the next major release will be!

They have also published (for the first time as I can recall) a list of changes that you can find right here: List of 2.1.4 Changes (http://svn.freepascal.org/svn/fpcbuild/tags/release_2_1_4/install/doc/whatsnew.txt)

This version is actually quite monumental in that it's one of the first FPC versions to be released with as many new platforms supported.

Some new platforms include Windows CE, GameBoy Advance and Nintendo DS.

The big winner of this version however has to be the addition of Win64! Thats right, Free Pascal is the first open source compiler to support 64-bit Windows operating systems!

Another new and wonderful thing about this new version is the new internal linker that was added. It supports all 3 Windows platforms; Win32, WinCE and Win64. This results in smaller executables, less memory used during compilation, and faster compile times for programs using large frameworks like for example the Lazarus Component Library.

There are tons of new things in this version that would take way too long for me to do a write-up on. Your best bet is to either go see for yourself or see how well the new compiler performs yourself.


Nice work FPC Team! :thumbup:


More information about Free Pascal can be found at www.FreePascal.org (http://www.freepascal.org/)!

Setharian
22-05-2007, 06:15 AM
they did a bad thing adding generics at this stage....Delphi should have generics (even Win32) in the Highlander which should be out by the 4th quarter of this year....and the syntax will be different...another incompatibility born....other than that, great job...

savage
22-05-2007, 11:54 AM
Can anyone point me to examples of their implementation of Generics.

I'm hoping it is at least following Chrome's implementation rather than creating a totally new one.

I was a big fan of STL when I first stumbled across them when learning C++ and having used them recently messing around with XNA, I really don't know how we did without it for so long.

Setharian
22-05-2007, 01:54 PM
type
generic TList<_T>=class(TObject)
type public
TCompareFunc = function(const Item1, Item2: _T): Integer;
var public
data : _T;
procedure Add(item: _T);
procedure Sort(compare: TCompareFunc);
end;
this is from the documentation...

WILL
22-05-2007, 01:57 PM
I'm still in lala-land with the whole generics thing. Don't know what it's for and why I'd use it. :P

As for the waiting on Delphi, I think that would have been a mistake in it's self. FPC is as much a leading compiler as the Delphi compiler is. The problem is that there is no standardization of the language sets being published by anyone so we're going to get this kind of discrepancies no matter what.

Do keep in mind though that it's the goal of Lazarus to mimic Delphi and not that of FreePascal. They are only trying to maintain current compatibility with their language differences. Something that is the onus of CodeGear to publish and make clear for it's userbase.

savage
22-05-2007, 02:21 PM
WILL you can read about generics and how to use them in Chrome here - http://www.chromesville.com/articles/?id={A1D08EE3-0D9E-4828-AFB3-B2C1E772186E}


What are Generics?
Generic types allow you to write strongly typed code that can later be used on a variety of different types. The classical example for efficient use of generics is container classes.

this is how Chrome defines a generic ]
type
List<T> = public class
public
constructor(aData: T);
constructor(aData: T; aNext: List<T>);

property Next: List<T>;
property Data: T;

method ToString: string; override;
end;
[/pascal]

you could then use this generic linked list definition for pretty much any TObject descendent, without requiring typecasting. The compiler fills in all the bits ( and bytes ) so to speak.

Setharian
22-05-2007, 02:24 PM
generics allow you to create a class (or a function) once and use it for different types in a type-safe manner (a TList implemented with generics could store pointers, classes, records, integers, strings, floats, etc. without the need of typecasting or other nasty tricks) simply said....they are a tool how to create more robust reusable code and how to make use of it more easily....I wonder how Delphi engineers will make it so that generic types are exportable from packages (or maybe they won't do it) as well as how will they integrate them with existing things like RTTI...we'll see ;)

if FPC will introduce constructs which will be available also under Delphi, but they will differ greatly, it will create quite a lot of confusion and will reduce the usage of those features by people who wish to maintain compatibility between FPC and Delphi (and many people are like that)..in the end it won't be good for anybody.....

dmantione
22-05-2007, 02:36 PM
Generics are like macro's; they exist at compile time only and they are expanded into code after that. Exporting generics from DLL like concepts like packages is something that doesn't compute to me.

We use a similar syntax similar to Chrome.

WILL
22-05-2007, 02:44 PM
Hmm... I wonder if the FPC Team will be considering Chrome language compatibility in the future as their compiler starts to gain popularity.

As Daniel says, they have already taken a cue (though maybe unintentionally) from Chrome in the implementation of generics.

dmantione
22-05-2007, 03:16 PM
We will look at how Chrome implemented things, just like we look at other compilers, since their is no need to be incompatible just for the heck of it. However, we don't intend to be Chrome compatible because:
* Effort/benefit ratio is at this time not in favour of it.
* Chrome language compatibility is not enough, Library compatibility is important too. Reimplementing all .NET libraries is not the best way the FPC team can spend its time.
* Many Chrome features are basically C#'isms we don't consider desired in Pascal.

savage
22-05-2007, 03:43 PM
* Many Chrome features are basically C#'isms we don't consider desired in Pascal.

I have to agree here to a certain extent. for example they use "new Typename();" to instantiate objects which is very C++/C# like, when they could have very easily just allowed "TypeName.Create;"

Legolas
22-05-2007, 03:57 PM
I'm wondering about the difference between fpc generics, c# generics and c++ templates. As far as I can see, fpc implementation looks much more similar to templates to me. Am I wrong? :think:

dmantione
22-05-2007, 04:16 PM
No you are not. The main difference between C++ templates and FPC generics is that FPC has been made a bit more strict and the semantics are a bit less macro-like.

jdarling
22-05-2007, 06:47 PM
So, this brings up the question of "How long till the official Lazarus version with support is out"?

Anyone know?

WILL
22-05-2007, 08:18 PM
Well I don't know how long it would take for the next Lazarus will come out. (Mind you the mantis bug tracker has been quite busy of late. Seeing quite a bit of work going into various issues.)

But I'm curious as to what kind of an increase in code speed we're looking at seeing in this version. I've read from the recent Doom2FPC project update that it actually ran a bit faster compiled with the new 2.1.4. Can anyone else back this up? Does 2.1.4 run that much faster than the previous stable 2.0.4 version?

dmantione
22-05-2007, 08:22 PM
Yes, it does. The use of SSE2 has been improved, it can store records in registers, it can convert recursion into iteration, it can remove stackframes, there is a primitive form of SSA (at start and end of procedures), the heap got more efficient, ...

Benchmark your code and you will see a nice speed improvement.

VilleK
23-05-2007, 12:57 PM
Just downloaded the new version and recompiled my project. I did not expect such an major update of Freepascal, it really seems like it is at the leading edge of technology and features at the moment. Great work! Looking forward to trying it some more.

jdarling
23-05-2007, 01:40 PM
Anyone have directions for upgrading FPC under Lazarus? I'd like to play with it, but the last time I tried upgrading my FPC I killed Lazarus :(

dmantione
23-05-2007, 02:01 PM
I suggest to wait until Lazarus has done the upgrade themselves. While theoretically it should be possible (as Lazarus can recompile itself), a lot can go wrong.

WILL
23-05-2007, 02:09 PM
Yeah, I'm tempted myself. :) But I'm gonna wait on the next Laz. The once bother sum amount of FPC/Lazarus bug reports from mantis (I mean I get them all! :p) are sort of giving me an indication of when that other release might be. :)

BTW, nice to see work on 2.3.x already! :thumbup:

Whats next on the list of major improvements? After 2.2.0 that is. More platforms? Even more optimizations? Further compatibility? Inquiring minds want to know. :D

dmantione
23-05-2007, 02:43 PM
One thing where I would like work are language extenstions by the Vector Pascal compiler. This would greatly allow the possibilities for vectorizable code, and they are usefull to make the language more powerfull too.

Another thing I would like to do is to review the core types of the language, i.e. the base types are one of the few things that remained the same over the years. Why are we limited to bytes, chars, enumerations, reals, and strings as base types is a question that I want to ask myself.

Take a look at the char type. It physically the same as a byte, but a separate type allows us type-safeness, specials syntax like character constants, and semantics, like string+char expressions.

There are many more things that could have their own build-in type, but for many things the type construction possibilities in Pascal are adequate. I.e. we absolutely don't need a build-in type for a 2D point or something. But perhaps we could make life easier for programmers with a type for a time and date, or perhaps ip-addresses. The question here is what advantage does it bring and is it worth compiler support?

Enhancements that are already in 2.3 are:
* The ability to use val/str/read(ln)/write(ln) on enumeration types.
* A redesigned heap manager that improves performance a lot in multithreaded applications and reduced the compiler memory usage by 25% (much less fragmentation)