The notation int add(int a,int b) {return a+b;}
has the disadvantage that it gets one to jump to the conclusion that add has non-atomic semantics where it waits - under the covers - for a
and b
to arrive before running. In my mind, at a very atomic level, a
and b
can arrive at separate times, hence add
must react separately to each arrival. If add wants to see an a
followed by a b
, it must explicitly specify this condition in its code. I learned about state machines in electrical engineering and, that is the obvious answer, in my mind, of how to specify such conditions.
See Also
Email: ptcomputingsimplicity@gmail.com
References: https://guitarvydas.github.io/2024/01/06/References.html
Blog: guitarvydas.github.io
Videos: https://www.youtube.com/@programmingsimplicity2980
Discord: https://discord.gg/65YZUh6Jpq
Leanpub: [WIP] https://leanpub.com/u/paul-tarvydas
Twitter: @paul_tarvydas
Substack: paultarvydas.substack.com