LWN.net Logo

PHP: a fractal of bad design (fuzzy notepad)

PHP: a fractal of bad design (fuzzy notepad)

Posted Apr 20, 2012 1:13 UTC (Fri) by mmorrow (subscriber, #83845)
In reply to: PHP: a fractal of bad design (fuzzy notepad) by mmorrow
Parent article: PHP: a fractal of bad design (fuzzy notepad)

Here's a better example:

The "elements" are C stmts thought of as mappings of memory configurations, and the binary operator is `;`. This is a monoid with identity element the empty C stmt.

Define,

modify(S) := the set of memory locations statement S *may* modify.

So now, `;` is commutative for every pair of statements S,T which *must not* (i.e. cannot under any possible dynamic execution path) modify one or more of the same memory locations.

(S ; T)===(T ; S) <==> modify(S)/\modify(T)==empty_set

(where "===" := equivalence wrt effect on memory)


(Log in to post comments)

PHP: a fractal of bad design (fuzzy notepad)

Posted Apr 20, 2012 1:37 UTC (Fri) by mmorrow (subscriber, #83845) [Link]

Actually that's not quite correct, it's more like:

(S ; T)===(T ; S)
<==>
modify(S)/\modify(T)==empty_set
AND
read(S)/\modify(T)==empty_set
AND
read(T)/\modify(S)==empty_set

or something along these lines, but the idea is clear.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds