December 19, 2012

Lambdas in Smart–Why does this make me happy?

Smart 1.1 will support the lambda syntax. Why is this a big deal?

It’s simple.

This is the old code:

  ResizeChildren(FClientArea.Height, [TAlign.Top, TAlign.Bottom],
function (layout: TLayoutImpl): Variant
begin
Result := layout.GetConfig.GetHeight;
end,
procedure (layout: TLayoutImpl; value: integer)
begin
layout.GetConfig.Height(value);
end);

And this is the new code:

  ResizeChildren(FClientArea.Height, [TAlign.Top, TAlign.Bottom],
lambda (layout) => layout.GetConfig.GetHeight,
lambda (layout, value) layout.GetConfig.Height(value) end);

Is this a good enough reason to be happy? I think it is!

No comments:

Post a Comment