1. Re: Euphoria Command Query Seperation
- Posted by Michael Nelson <mikestar13 at sbcglobal.net>
Sep 21, 2005
-
Last edited Sep 22, 2005
--0-759142506-1127339151=:24816
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
I think open would have to be a procedure in a CQS language and then
you
would need another function get the the file_descriptor from the
filename.
procedure open(filename,how)
function getfd(filename)
Euphoria has the property of pass by value. Nothing passed into a
function is modified to the caller unless it is a global and that is
what makes Euphoria a beauty.
I think SQL standard has CQS, except for reporting success or failure
when
executing commands nothing is returned by commands and queries are only
queries.
Shawn Pringle
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
--0-759142506-1127339151=:24816
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<DIV>
<DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px;
BORDER-LEFT: #1010ff 2px solid">
<P>posted by: Shawn <pringle at techie.com><BR><BR>I think open would have
to be a procedure in a CQS language and then <BR>you <BR>would need another
function get the the file_descriptor from the <BR>filename.
<BR><BR>procedure open(filename,how)<BR>function getfd(filename)<BR><BR>Euphoria
has the property of pass by value. Nothing passed into a <BR>function is
modified to the caller unless it is a global and that is <BR>what makes Euphoria
a beauty.<BR><BR>I think SQL standard has CQS, except for reporting success or
failure <BR>when<BR>executing commands nothing is returned by commands and
queries are only<BR>queries.<BR><BR>Shawn Pringle</P>
<P> </P>
<P>A simpler approach might be to allow procedures (commands) to user pass by
reference (when declared in the procedure definition). So we would have </P>
<P>procedure open(sequence filename,sequence mode, byref integer filenumber)</P>
<P>and our code would look like:</P>
<P>integer
fn
open("xxx.txt","a",fn)
if fn=-1 then -- error handling</P>
<P> </P>
<P> </P>
<P> </P></BLOCKQUOTE></DIV></DIV>
--0-759142506-1127339151=:24816--