1. Re: Euphoria Command Query Seperation
- Posted by Shawn <pringle at techie.com> Sep 24, 2005
- 410 views
- Last edited Sep 25, 2005
I know what you are supposing would amount to less routine calls than what I was talking about and be more simplier but it would break the principle of CQS. I am not advocating CQS but merely stating a way this could be designed if CQS were enforced. In your example, you are only just changing the return mechanism from one to another. The idea of CQS was that functions would not change the state of anything but could return what the states were. Procedures, which return nothing, would change the global state. I see there are disadvantages to CQS . Michael Nelson wrote: > > --0-759142506-1127339151=:24816 > Content-Type: text/plain; charset=iso-8859-1 > Content-Transfer-Encoding: 8bit > > A simpler approach might be to allow procedures (commands) to user pass by > reference > (when declared in the procedure definition). So we would have > > procedure open(sequence filename,sequence mode, byref integer filenumber) > > and our code would look like: > > integer fn > > open("xxx.txt","a",fn) > > if fn=-1 then > -- error > handling >