Message from discussion
Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?
Received: by 10.58.222.100 with SMTP id ql4mr839594vec.22.1345754074959;
Thu, 23 Aug 2012 13:34:34 -0700 (PDT)
X-BeenThere: nodejs@googlegroups.com
Received: by 10.52.92.107 with SMTP id cl11ls902751vdb.4.gmail; Thu, 23 Aug
2012 13:34:24 -0700 (PDT)
Received: by 10.52.28.83 with SMTP id z19mr547696vdg.20.1345754064907;
Thu, 23 Aug 2012 13:34:24 -0700 (PDT)
Date: Thu, 23 Aug 2012 13:34:24 -0700 (PDT)
From: rektide <rekt...@voodoowarez.com>
To: nodejs@googlegroups.com
Message-Id: <3ace96a5-45f3-4e6a-98ea-71fedc96b22b@googlegroups.com>
In-Reply-To: <1b8f048f-609d-4a0e-a28a-ff4bbecf38a3@googlegroups.com>
References: <1b8f048f-609d-4a0e-a28a-ff4bbecf38a3@googlegroups.com>
Subject: Re: Why `fs.exists` has signature `(exists)` instead of `(err,
exists)` ?
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_82_29911828.1345754064525"
------=_Part_82_29911828.1345754064525
Content-Type: multipart/alternative;
boundary="----=_Part_83_27238319.1345754064531"
------=_Part_83_27238319.1345754064531
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
I would really really appreciate it if Node were to consistently get behind
err being the first param, even when it's nonsensical.
Readline.question could stand being made from answer => void to err,answer
=> void as well.
On Friday, August 17, 2012 6:57:18 PM UTC-4, Alexey Petrushin wrote:
>
> Wondering why `fs.exists` doesn't comply to async methods pattern and
> doesn't return error as a first argument?
>
> It uses
>
> fs.exists('/etc/passwd', function (exists) {
> util.debug(exists ? "it's there" : "no passwd!");});
>
>
> Instead of
>
> fs.exists('/etc/passwd', function (err, exists) {
> util.debug(exists ? "it's there" : "no passwd!");});
>
>
------=_Part_83_27238319.1345754064531
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
I would really really appreciate it if Node were to consistently get behind=
err being the first param, even when it's nonsensical.<div><br></div><div>=
Readline.question could stand being made from answer =3D> void to err,an=
swer =3D> void as well.<br><br>On Friday, August 17, 2012 6:57:18 PM UTC=
-4, Alexey Petrushin wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Won=
dering why `fs.exists` doesn't comply to async methods pattern and doesn't =
return error as a first argument?<div><br></div><div>It uses</div><div><br>=
</div><div><pre style=3D"font-size:14px;line-height:1.5438em;font-family:Mo=
naco,Consolas,'Lucida Console',monospace;margin-bottom:1.1em;padding:1em 1.=
6em 1em 1.2em;vertical-align:top;background-color:rgb(248,248,248);border-s=
tyle:solid;border-color:rgb(232,232,232);border-width:1px 1px 1px 6px;overf=
low-x:auto;color:rgb(0,0,0)"><code style=3D"font-size:14px;line-height:1.54=
38em;font-family:Monaco,Consolas,'Lucida Console',monospace">fs<span style=
=3D"color:rgb(51,51,51)">.</span><span>exists</span><span style=3D"color:rg=
b(51,51,51)">(</span><span style=3D"color:rgb(102,153,0)">'/etc/passwd'</sp=
an><span style=3D"color:rgb(51,51,51)">,</span> <span style=3D"color:rgb(20=
4,153,102)">function</span> <span style=3D"color:rgb(51,51,51)">(</span>exi=
sts<span style=3D"color:rgb(51,51,51)">)</span> <span style=3D"color:rgb(51=
,51,51)">{</span>
util<span style=3D"color:rgb(51,51,51)">.</span><span>debug</span><span s=
tyle=3D"color:rgb(51,51,51)">(</span>exists <span style=3D"color:rgb(51,51,=
51)">?</span> <span style=3D"color:rgb(102,153,0)">"it's there"</span> <spa=
n style=3D"color:rgb(51,51,51)">:</span> <span style=3D"color:rgb(102,153,0=
)">"no passwd!"</span><span style=3D"color:rgb(51,51,51)">);</span>
<span style=3D"color:rgb(51,51,51)">}</span><span style=3D"color:rgb(51,51,=
51)">);</span></code></pre></div><div><br></div><div>Instead of</div><div><=
br></div><div><pre style=3D"font-size:14px;line-height:1.5438em;font-family=
:Monaco,Consolas,'Lucida Console',monospace;margin-bottom:1.1em;padding:1em=
1.6em 1em 1.2em;vertical-align:top;background-color:rgb(248,248,248);borde=
r-style:solid;border-color:rgb(232,232,232);border-width:1px 1px 1px 6px;ov=
erflow-x:auto;color:rgb(0,0,0)"><code style=3D"font-size:14px;line-height:1=
.5438em;font-family:Monaco,Consolas,'Lucida Console',monospace">fs<span sty=
le=3D"color:rgb(51,51,51)">.</span><span>exists</span><span style=3D"color:=
rgb(51,51,51)">(</span><span style=3D"color:rgb(102,153,0)">'/etc/passwd'</=
span><span style=3D"color:rgb(51,51,51)">,</span> <span style=3D"color:rgb(=
204,153,102)">function</span> <span style=3D"color:rgb(51,51,51)">(err, </s=
pan>exists<span style=3D"color:rgb(51,51,51)">)</span> <span style=3D"color=
:rgb(51,51,51)">{</span>
util<span style=3D"color:rgb(51,51,51)">.</span><span>debug</span><span s=
tyle=3D"color:rgb(51,51,51)">(</span>exists <span style=3D"color:rgb(51,51,=
51)">?</span> <span style=3D"color:rgb(102,153,0)">"it's there"</span> <spa=
n style=3D"color:rgb(51,51,51)">:</span> <span style=3D"color:rgb(102,153,0=
)">"no passwd!"</span><span style=3D"color:rgb(51,51,51)">);</span>
<span style=3D"color:rgb(51,51,51)">}</span><span style=3D"color:rgb(51,51,=
51)">);</span></code></pre></div></blockquote></div>
------=_Part_83_27238319.1345754064531--
------=_Part_82_29911828.1345754064525--