[Lazarus] 'with' is evil, isn't it?

Alexsander Rosa alexsander.rosa at gmail.com
Wed Aug 3 23:55:11 CEST 2011


We use "with" to populate or display properties of objects from our in-house
OPF. However we have some ground rules: most properties are mapped from
tables (DAO pattern) and their names are in portuguese and with an
underscore, like "valor_total".

A common code looks like this:
*with mCliente do begin
  edtNomeRazao.Text := Nome_Razao;
  edtDataNasc.Text := DateToStr(Data_Nascimento);
  edtLimiteCredito.Text := Format('.2n',[Limite_Credito]);
  ...
  end;
*
This works fine.


2011/8/3 Fr0sT <fr0st.brutal at gmail.com>

> I personally use "with" widely and never experienced any troubles with
> it but I know that many people just hate this statement (see
> discussion on Emb-ro forums and one of the most popular requests on
> Emb-ro quality central).
> I guess problem could be solved by modifying statement like this:
>  with some.very.very.long.name as foo, some.other.giant.object.name as bar
> do
>    foo.Field := bar.Field
> but it IMHO violates Pascal syntax philosophy.
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Atenciosamente,
Alexsander da Rosa
http://rednaxel.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110803/b9b840d5/attachment-0003.html>


More information about the Lazarus mailing list