Am 28.02.2012 20:31, schrieb Lukasz Stafiniak:
On Tue, Feb 28, 2012 at 8:22 AM, Noah Silva
<shir...@galapagossoftware.com> wrote:
If you want to convince people to use FPC and are having issues, you should
ask them what features, exactly, they are looking for. Chances are that FPC
has them. (If they want a functional language, though, then you're out of
luck).
Pascal is not entirely opposed to being a functional language. There
are two missing language features (consider it a proposal of
Functional Pascal):
(1) A declaration part, that parallels "var", with keyword "val" or
"let" (since "val" is taken up by a procedure). It introduces named
values, i.e. non-assignable variables. The part after "=" can be any
expression. Therefore, this feature spoils the "declaration --
implementation divide" that is dear to Pascal.
I personally don't see a use for this... but feel free to provide a
useful example ;)
(2) Closures. That is, making local functions that only use "const"
arguments and "val / let" variables safe to return from the outer
function. This can be done by allocating the "val / let" data on the
heap, or perhaps easier by copying them into an implicitly built
object and interpreting the returned local function as pointer to
method of this object. The closure-object would be memory-managed as
other objects.
Closures are already supported by Delphi 2009 and are currently being
worked on by someone in FPC.
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal