<div dir="ltr">Pascal have something close to lambda, and it's nested functions/procedures<br><br>The original idea of lambda is to have sub process that takes parameters and simple tasks.<br>For example (in Ruby):<br>

<br>def action(base)<br>  expo = lambda { |by_num| base ** by_num}<br>  x = something<br>  a = expo(x)<br>  ....<br>end<br><br>I can do the same with the following:<br><br>procedure action(base : integer)<br>  function expo(by_num)<br>

  begin<br>    expo := base ** by_num<br>  end;<br>var x,a : integer;<br>begin<br>   x := something;<br>  a := expo(x);<br> ...<br>end;<br><br>Of curse it's one usage for it, but most of the real usage of lambda can be made in pascal today. And please do not take ideas from C++, it's a language that wrote on it's agenda to implement any possible technology out there regardless of it's need or  usage, and it's impossible to use that language without some framework or ignoring this technologies. <br>

<br>Ido<br clear="all"><a href="http://ik.homelinux.org/">http://ik.homelinux.org/</a><br>
<br><br><div class="gmail_quote">2009/10/20 Dariusz Mazur <span dir="ltr"><<a href="mailto:darekm@emadar.com">darekm@emadar.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Michael Schnell pisze:<div class="im"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Again something inspired by Delphi-Prism ?<br>
<br>
( <a href="http://prismwiki.codegear.com/en/Lambda_Expressions" target="_blank">http://prismwiki.codegear.com/en/Lambda_Expressions</a> )<br>
<br>
  <br>
</blockquote></div>
No at all, I don't even see this before. I thing long about this. But lately I see this in C++ (strange) and Lisp (beautiful)<br>
In Prism have You:<br>
<br>
c -> c.Name = 'Smith'<br>
<br>
which is very strange, special syntax, and need to be translate to "method", and declaration longer than one line is awful,<br>
<br>
my proposition semantically is between properties (they consist also two function), aspect programming and lambda<br>
<br>
is very easy to translate to ordinal pascal( lambda invoke change to repeat-while iteration,<br>
similarly as in generics)<br>
<br>
has wider application:<br>
<br>
from FPC WIKI:<br>
procedure StringLoop(S: String);<br>
var<br>
 C: Char;<br>
begin<br>
 for C in S do<br>
   DoSomething(C);<br>
end; <br>
my prop:<br>
<br>
procedure stringloop(s :tMyString);<br>
begin<br>
  {with} s.eachword do begin<br>
     if s.currentword<>'begin' then<br>
       writeln(s.currentword);<br>
  end;<br>
end;<br>
<br>
of course I can write<br>
     procedure stringloop(s :tMyString);<br>
begin<br>
  s.firstWord;<br>
  try<br>
  while  s.nexword do begin<br>
     if s.currentword<>'begin' then<br>
       writeln(s.currentword);<br>
  end;<br>
  except<br>
    s.exceptWord;<br>
  end;  end;<br>
<br>
which can be equivalent<br>
<br>
from compiler side invoke of lambda is translate to proper iteration before main compilation<br>
from developer side: its easy to use as properties, fewer bugs caused forget of initialization or finalization, or use incompatible  init and step<br>
function in iterators<br><font color="#888888">
<br>
<br>
<br>
<br>
-- <br>
 Darek</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-devel" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-devel</a><br>
</div></div></blockquote></div><br></div>