Hello fredvs,

you wrote on Mon, 9 Mar 2020 02:00:30 -0700 (MST):

> > I'd rather suggest parentheizing the first partial expression, like so:
> >  if (fld1 is tblobfield) and (self.fblobintf <> nil) then begin   
> 
> Yes, it is exactly what was proposed in fpc mailing list.
> 
> It is also what I did commit in mse-org/mseide_msegui

Good. Relying on the operator precedence can often cause problems, and it
becomes completely unreliable when diverse types are involved.
Usually, I try to avoid the ambiguity of such constructs by explicitely
parenthesizing them. This is mainly because I often have to change between
different languages, and thus different operator hierarchies. About the
only safe precedence rules are those of school mathematics - i.e.
multiply/divide comes before add/subtract - but anything else, even
handling of booleans, can vary.
I'd recommend copiously paranthesizing complex expressions as a standard,
and parentesizing partial expressions resulting in a different type from
the operands specifically.

(Of course, in many such cases, it might be possible for the compiler to
resolve an ambigous construct by contemplating the type structure of the
expression, but there _will_ be cases where that's _not_ what the writer
intended - so at least a warning will have to be issued and an explanation
of the assumed coercion given, As that is not a trivial thing, it seems
most implementations "play it dumb" and only perform minimal processing.)

-- 
-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------




_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to