Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-24 Thread Dennis Kehrig
Hey group,

Bruno Jouhier, 2012-08-23 22:45:
 fs: stability 3 (Stable) = Backwards compatibility is guaranteed.

How about this:

if (callback.length  1) {
callback(err, res);
} else {
callback(res);
}

Would that be okay? Might be an issue if the callback is declared
without parameters and uses the arguments variable instead. With the
code above old code would continue to work, but new code using only the
arguments array would be surprised by only getting one parameter.

Greetings,

Dennis

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-23 Thread Isaac Schlueter
Scott Gonzalez posted a good link about deprecation.  I copied it to a
wiki page.  This is the official policy:
https://github.com/joyent/node/wiki/deprecation

I'd accept a pull request that explains the oddness of fs.exists in
the documentation.  Making it non-enumerable or removing it from the
docs is a bad idea, on further consideration.

I'd also accept a pull request that documents all the Posix error
codes, though really, that should probably be part of the libuv
documentation.  (But writing docs for libuv is a much larger pull
request.)


On Wed, Aug 22, 2012 at 9:49 PM, Mikeal Rogers mikeal.rog...@gmail.com wrote:
 This suggested gained a lot of +1's so i want to talk about it a moment.

 I don't think it's suitable to *remove* APIs that still exist from the docs 
 or hide them from being enumerable.

 There are just too many node programs out there now and people who want to 
 understand existing code need to read the documentation for an API that *is 
 still active* should be able to find and view it and to debug that API via 
 test code in the repl which making non-enumerable makes annoying.

 This just isn't the grown up way to handle a mistake or a deprecation.

 We need to call out in the docs that 1) this exists and is still available 2) 
 it should not be used 3) why it should not be used and links to doing things 
 the right way. Pretending it doesn't exist when it still does is like 
 pretending we never made this mistake even though it still works in node. 
 Let's take responsibility for this and do what's best for all of the existing 
 and future users of node.

 -Mikeal

 On Aug 20, 2012, at August 20, 20128:53 AM, Tim Caswell t...@creationix.com 
 wrote:

 How about removing it from the docs and making it non-enumerable in
 the fs module.  Then any new developers won't know it's there unless
 they are reading someone else's code.  Or maybe in the docs simply say
 that it shouldn't be used and is only left there so as to not break
 old code.  Also, how is this different from deprecation?

 On Sun, Aug 19, 2012 at 4:02 PM, Bert Belder bertbel...@gmail.com wrote:
 On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote:

 Maybe a note in the docs tell people that fs.stat is a better choice?

 Good idea Mikeal. Deprecation console.error  pointing people to
 fs.stat in the docs should do the trick.


 I don't see enough compelling reasons to deprecate it. I think a doc
 addition that warns people about the funky signature and the anti-pattern
 would suffice.

 - Bert


 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-23 Thread Bruno Jouhier
fs: stability 3 (Stable) = Backwards compatibility is guaranteed.

There was an opportunity to fix it when moving it from path to fs. But now 
it's too late!

Well, that's just life! 

On Thursday, August 23, 2012 5:12:30 PM UTC+2, Isaac Schlueter wrote:

 Scott Gonzalez posted a good link about deprecation.  I copied it to a 
 wiki page.  This is the official policy: 
 https://github.com/joyent/node/wiki/deprecation 

 I'd accept a pull request that explains the oddness of fs.exists in 
 the documentation.  Making it non-enumerable or removing it from the 
 docs is a bad idea, on further consideration. 

 I'd also accept a pull request that documents all the Posix error 
 codes, though really, that should probably be part of the libuv 
 documentation.  (But writing docs for libuv is a much larger pull 
 request.) 


 On Wed, Aug 22, 2012 at 9:49 PM, Mikeal Rogers 
 mikeal...@gmail.comjavascript: 
 wrote: 
  This suggested gained a lot of +1's so i want to talk about it a moment. 
  
  I don't think it's suitable to *remove* APIs that still exist from the 
 docs or hide them from being enumerable. 
  
  There are just too many node programs out there now and people who want 
 to understand existing code need to read the documentation for an API that 
 *is still active* should be able to find and view it and to debug that API 
 via test code in the repl which making non-enumerable makes annoying. 
  
  This just isn't the grown up way to handle a mistake or a deprecation. 
  
  We need to call out in the docs that 1) this exists and is still 
 available 2) it should not be used 3) why it should not be used and links 
 to doing things the right way. Pretending it doesn't exist when it still 
 does is like pretending we never made this mistake even though it still 
 works in node. Let's take responsibility for this and do what's best for 
 all of the existing and future users of node. 
  
  -Mikeal 
  
  On Aug 20, 2012, at August 20, 20128:53 AM, Tim Caswell 
 t...@creationix.com javascript: wrote: 
  
  How about removing it from the docs and making it non-enumerable in 
  the fs module.  Then any new developers won't know it's there unless 
  they are reading someone else's code.  Or maybe in the docs simply say 
  that it shouldn't be used and is only left there so as to not break 
  old code.  Also, how is this different from deprecation? 
  
  On Sun, Aug 19, 2012 at 4:02 PM, Bert Belder 
  bertb...@gmail.comjavascript: 
 wrote: 
  On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote: 
  
  Maybe a note in the docs tell people that fs.stat is a better 
 choice? 
  
  Good idea Mikeal. Deprecation console.error  pointing people to 
  fs.stat in the docs should do the trick. 
  
  
  I don't see enough compelling reasons to deprecate it. I think a doc 
  addition that warns people about the funky signature and the 
 anti-pattern 
  would suffice. 
  
  - Bert 
  
  
  -- 
  Job Board: http://jobs.nodejs.org/ 
  Posting guidelines: 
  https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
  You received this message because you are subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  -- 
  Job Board: http://jobs.nodejs.org/ 
  Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
  You received this message because you are subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  -- 
  Job Board: http://jobs.nodejs.org/ 
  Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
  You received this message because you are subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Alan Gutierrez
On Wed, Aug 22, 2012 at 12:32:59PM +0200, Dominic Tarr wrote:
 I agree with Tim Caswell. Lets face it, that exists exists is embarassing.
 removing it from the docs (replace with a link to stat) but leaving it
 in the code (with a big comment) is the right compromise. once
 everyone has forgotten about it, it will be easier to remove it.
 
 I understand isaac's position. he doesn't want to remove exists,
 because although it's a breaking change, and although we LOVE breaking
 changes in node, what we really love about breaking changes is when a
 breaking change is a breaking improvement.
 
 but this is only a cosmetic improvement. there will be no associated
 performance improvement...

Consistency is a hobgoblin and all that. I'm glad that node doesn't waste time
on the sort of refactoring that plagued open source a few years back; endlessly
refactoring for the sake of a taxonomy that is closer to the Platonic form.

I really appreciate the way decisions to alter node are made.

However, that `exists` has a different signature from everything else has always
felt like a burr. I'm surprised it lives on. I'm surprised there is a function
that's been left in node that whenever anyone uses it, they are told not to,
because checking for existence is an anti-pattern, and `stat` is better.

That is a waste of community energy: having a bright shinny function that draws
newbies like moths, only to have the community zap them when they use it.

It it a test?

--
Alan Gutierrez - http://twitter.com/bigeasy

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Alexey Petrushin
By the way, why checking for existence is 'anti-pattern'? Can You please 
give a link to the detailed description of such case?

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Tim Caswell
On Wed, Aug 22, 2012 at 12:54 PM, Alexey Petrushin
alexey.petrus...@gmail.com wrote:
 By the way, why checking for existence is 'anti-pattern'? Can You please
 give a link to the detailed description of such case?

Because if you're going to do anything with the file after checking
for it, why not just try to do the thing in the first place.  It's a
race condition anyway.  The file might disappear between checking for
it and trying to use it.  At least with fs.stat you get the
information about the file if it exists, and a detailed error object
if it doesn't.  Performance wise, this is the same number of syscalls
and less JS function calls. (fs.exists is just a wrapper around
fs.stat anyway)  Also fs.exists lies sometimes.  Since it can only
return a true or false, what should it do if the file exists, but
you're not able to read it?  What if you're not able to enter it's
parent directory?

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Alexey Petrushin
Thanks for explanation Tim, I got it, although, I'm not sure that it's 
worth it.

In most cases (except rare performance bottleneck) I'd prefer clear code 
like `create file unless file exists` instead of implicit logic relying on 
error handling like `create file rescue error`, but, this is only my 
opinion, not insisting on it.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Jimb Esser
Yeah, there are a lot of cases where does not exists as an error needs 
to be treated differently.  I tried making a read from this file, return a 
default value if it does not exist function without using fs.exists, and 
was unable to do so efficiently without relying on undocumented error code 
values [1].  It's very unclear if that code will work on different versions 
of node let alone different operating systems.  It's vitally important in 
cases like rename this file to a backup before overwriting that an 
error in the process is treated differently than file does not exists, 
so fs.exists does serve a purpose, even if its signature could have been 
designed in a more conformant manner.

[1] https://gist.github.com/3429037

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Nathan Rajlich
Checking err.code for ENOENT is the most cross-platform and
backwards compatible way to check for the existence of the file.

On Wed, Aug 22, 2012 at 1:29 PM, Jimb Esser wastel...@gmail.com wrote:
 Yeah, there are a lot of cases where does not exists as an error needs
 to be treated differently.  I tried making a read from this file, return a
 default value if it does not exist function without using fs.exists, and
 was unable to do so efficiently without relying on undocumented error code
 values [1].  It's very unclear if that code will work on different versions
 of node let alone different operating systems.  It's vitally important in
 cases like rename this file to a backup before overwriting that an error
 in the process is treated differently than file does not exists, so
 fs.exists does serve a purpose, even if its signature could have been
 designed in a more conformant manner.

 [1] https://gist.github.com/3429037

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Isaac Schlueter
Yeah, Jimb, I'm not sure I know what you mean by undocumented error
code values.  Node does assume some familiarity with Posix error code
values, but that's a very long and well-documented tradition.

Actually, your gist is a perfect example of why fs.exists is a)
unnecessary, and b) almost always the wrong idea.  In the first case,
if the file exists, but is not readable, then the fs.exists() will
return false, and your program will act as if the file is *missing*,
which is incorrect.


On Wed, Aug 22, 2012 at 2:10 PM, Nathan Rajlich nat...@tootallnate.net wrote:
 Checking err.code for ENOENT is the most cross-platform and
 backwards compatible way to check for the existence of the file.

 On Wed, Aug 22, 2012 at 1:29 PM, Jimb Esser wastel...@gmail.com wrote:
 Yeah, there are a lot of cases where does not exists as an error needs
 to be treated differently.  I tried making a read from this file, return a
 default value if it does not exist function without using fs.exists, and
 was unable to do so efficiently without relying on undocumented error code
 values [1].  It's very unclear if that code will work on different versions
 of node let alone different operating systems.  It's vitally important in
 cases like rename this file to a backup before overwriting that an error
 in the process is treated differently than file does not exists, so
 fs.exists does serve a purpose, even if its signature could have been
 designed in a more conformant manner.

 [1] https://gist.github.com/3429037

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Jimb Esser
I can find no reference in the Node documentation to ENOENT other than in 
regards to DNS functions, no description at all in the File System 
documentation on what the error objects are (other than examples using them 
as booleans or opaque types to be displayed or thrown), nothing even saying 
an Error type has a code member you can reliably do anything with.  I 
would not call that well-documented.  Coming from Windows-land, having 
never seen ENOENT before, I just assumed that was an internal libuv 
identifier or something.

At least in any case I tested, if a file exists and is not readable, 
fs.exists returns true, as I'd expect.  There are probably some cases 
(perhaps if the file is in a location you do not have access to, as opposed 
to the fairly common case of just being unable to access a file) where the 
current fs.exists would return false, but that's just a really good 
argument that the current fs.exists should only return false if stat 
returned an error *and* that error was ENOENT or whichever set of error 
codes indicates non-existence, not that the API is flawed.  Abstracting 
away exactly which behaviors or error codes indicate existence is useful.

On Wednesday, August 22, 2012 2:32:43 PM UTC-7, Isaac Schlueter wrote:

 Yeah, Jimb, I'm not sure I know what you mean by undocumented error 
 code values.  Node does assume some familiarity with Posix error code 
 values, but that's a very long and well-documented tradition. 

 Actually, your gist is a perfect example of why fs.exists is a) 
 unnecessary, and b) almost always the wrong idea.  In the first case, 
 if the file exists, but is not readable, then the fs.exists() will 
 return false, and your program will act as if the file is *missing*, 
 which is incorrect. 


 On Wed, Aug 22, 2012 at 2:10 PM, Nathan Rajlich 
 nat...@tootallnate.netjavascript: 
 wrote: 
  Checking err.code for ENOENT is the most cross-platform and 
  backwards compatible way to check for the existence of the file. 
  
  On Wed, Aug 22, 2012 at 1:29 PM, Jimb Esser 
  wast...@gmail.comjavascript: 
 wrote: 
  Yeah, there are a lot of cases where does not exists as an error 
 needs 
  to be treated differently.  I tried making a read from this file, 
 return a 
  default value if it does not exist function without using fs.exists, 
 and 
  was unable to do so efficiently without relying on undocumented error 
 code 
  values [1].  It's very unclear if that code will work on different 
 versions 
  of node let alone different operating systems.  It's vitally important 
 in 
  cases like rename this file to a backup before overwriting that an 
 error 
  in the process is treated differently than file does not exists, so 
  fs.exists does serve a purpose, even if its signature could have been 
  designed in a more conformant manner. 
  
  [1] https://gist.github.com/3429037 
  
  -- 
  Job Board: http://jobs.nodejs.org/ 
  Posting guidelines: 
  https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
  You received this message because you are subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 
  
  -- 
  Job Board: http://jobs.nodejs.org/ 
  Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
  You received this message because you are subscribed to the Google 
  Groups nodejs group. 
  To post to this group, send email to nod...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  nodejs+un...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/nodejs?hl=en?hl=en 


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Dan Milon

Isaac, i am curious why you believe fs.exists should stay as is.
I found your previous mail kind of autarchic. Some 
communication/reasoning will surely make each side understand better the 
pros/cons.


danmilon.

On 08/23/2012 12:32 AM, Isaac Schlueter wrote:

Yeah, Jimb, I'm not sure I know what you mean by undocumented error
code values.  Node does assume some familiarity with Posix error code
values, but that's a very long and well-documented tradition.

Actually, your gist is a perfect example of why fs.exists is a)
unnecessary, and b) almost always the wrong idea.  In the first case,
if the file exists, but is not readable, then the fs.exists() will
return false, and your program will act as if the file is *missing*,
which is incorrect.


On Wed, Aug 22, 2012 at 2:10 PM, Nathan Rajlich nat...@tootallnate.net wrote:

Checking err.code for ENOENT is the most cross-platform and
backwards compatible way to check for the existence of the file.

On Wed, Aug 22, 2012 at 1:29 PM, Jimb Esser wastel...@gmail.com wrote:

Yeah, there are a lot of cases where does not exists as an error needs
to be treated differently.  I tried making a read from this file, return a
default value if it does not exist function without using fs.exists, and
was unable to do so efficiently without relying on undocumented error code
values [1].  It's very unclear if that code will work on different versions
of node let alone different operating systems.  It's vitally important in
cases like rename this file to a backup before overwriting that an error
in the process is treated differently than file does not exists, so
fs.exists does serve a purpose, even if its signature could have been
designed in a more conformant manner.

[1] https://gist.github.com/3429037

--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


--
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Scott González
On Wed, Aug 22, 2012 at 6:34 PM, Dan Milon danmi...@gmail.com wrote:

 Isaac, i am curious why you believe fs.exists should stay as is.


https://groups.google.com/forum/#!msg/nodejs/oqlT9ZtUZd0/XicWJx6mC4oJ

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Stewart Mckinney
Why not just decorate fs.exists with arguments.caller.length and call it a
day? It seems like there are arguments on both sides here to accept the new
standard and the old tradition. Eventually phasing out the old tradition
has to happen ( especially since you know, not 1.0 or anything here ), but
i'm just curious if there's any resistance to that interim solution right
now. Seems like that could work, and polymorphism is not necessarily a
forsaken tradition in programming.

Also,


Why does GMail think that polymorphism is not a word? Seriously?

On Wed, Aug 22, 2012 at 6:45 PM, Scott González scott.gonza...@gmail.comwrote:

 On Wed, Aug 22, 2012 at 6:34 PM, Dan Milon danmi...@gmail.com wrote:

 Isaac, i am curious why you believe fs.exists should stay as is.


 https://groups.google.com/forum/#!msg/nodejs/oqlT9ZtUZd0/XicWJx6mC4oJ

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Matt
In javascript you can't know how many arguments a callback takes. Only how
many arguments were passed to a function.

On Wed, Aug 22, 2012 at 11:30 PM, Stewart Mckinney lordma...@gmail.comwrote:

 Why not just decorate fs.exists with arguments.caller.length and call it a
 day? It seems like there are arguments on both sides here to accept the new
 standard and the old tradition. Eventually phasing out the old tradition
 has to happen ( especially since you know, not 1.0 or anything here ), but
 i'm just curious if there's any resistance to that interim solution right
 now. Seems like that could work, and polymorphism is not necessarily a
 forsaken tradition in programming.

 Also,


 Why does GMail think that polymorphism is not a word? Seriously?

 On Wed, Aug 22, 2012 at 6:45 PM, Scott González 
 scott.gonza...@gmail.comwrote:

 On Wed, Aug 22, 2012 at 6:34 PM, Dan Milon danmi...@gmail.com wrote:

 Isaac, i am curious why you believe fs.exists should stay as is.


 https://groups.google.com/forum/#!msg/nodejs/oqlT9ZtUZd0/XicWJx6mC4oJ

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en


  --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Stewart Mckinney
Ah, nevermind. Realized why. :/

On Wed, Aug 22, 2012 at 11:30 PM, Stewart Mckinney lordma...@gmail.comwrote:

 Why not just decorate fs.exists with arguments.caller.length and call it a
 day? It seems like there are arguments on both sides here to accept the new
 standard and the old tradition. Eventually phasing out the old tradition
 has to happen ( especially since you know, not 1.0 or anything here ), but
 i'm just curious if there's any resistance to that interim solution right
 now. Seems like that could work, and polymorphism is not necessarily a
 forsaken tradition in programming.

 Also,


 Why does GMail think that polymorphism is not a word? Seriously?

 On Wed, Aug 22, 2012 at 6:45 PM, Scott González 
 scott.gonza...@gmail.comwrote:

 On Wed, Aug 22, 2012 at 6:34 PM, Dan Milon danmi...@gmail.com wrote:

 Isaac, i am curious why you believe fs.exists should stay as is.


 https://groups.google.com/forum/#!msg/nodejs/oqlT9ZtUZd0/XicWJx6mC4oJ

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en




-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Nathan Rajlich
callback.length

On Wed, Aug 22, 2012 at 8:36 PM, Stewart Mckinney lordma...@gmail.com wrote:
 Ah, nevermind. Realized why. :/

 On Wed, Aug 22, 2012 at 11:30 PM, Stewart Mckinney lordma...@gmail.com
 wrote:

 Why not just decorate fs.exists with arguments.caller.length and call it a
 day? It seems like there are arguments on both sides here to accept the new
 standard and the old tradition. Eventually phasing out the old tradition has
 to happen ( especially since you know, not 1.0 or anything here ), but i'm
 just curious if there's any resistance to that interim solution right now.
 Seems like that could work, and polymorphism is not necessarily a forsaken
 tradition in programming.

 Also,


 Why does GMail think that polymorphism is not a word? Seriously?

 On Wed, Aug 22, 2012 at 6:45 PM, Scott González scott.gonza...@gmail.com
 wrote:

 On Wed, Aug 22, 2012 at 6:34 PM, Dan Milon danmi...@gmail.com wrote:

 Isaac, i am curious why you believe fs.exists should stay as is.


 https://groups.google.com/forum/#!msg/nodejs/oqlT9ZtUZd0/XicWJx6mC4oJ

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en



 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Nathan Rajlich
Also, somebody really should turn this thread into a pull request ;)

On Wed, Aug 22, 2012 at 8:58 PM, Nathan Rajlich nat...@tootallnate.net wrote:
 callback.length

 On Wed, Aug 22, 2012 at 8:36 PM, Stewart Mckinney lordma...@gmail.com wrote:
 Ah, nevermind. Realized why. :/

 On Wed, Aug 22, 2012 at 11:30 PM, Stewart Mckinney lordma...@gmail.com
 wrote:

 Why not just decorate fs.exists with arguments.caller.length and call it a
 day? It seems like there are arguments on both sides here to accept the new
 standard and the old tradition. Eventually phasing out the old tradition has
 to happen ( especially since you know, not 1.0 or anything here ), but i'm
 just curious if there's any resistance to that interim solution right now.
 Seems like that could work, and polymorphism is not necessarily a forsaken
 tradition in programming.

 Also,


 Why does GMail think that polymorphism is not a word? Seriously?

 On Wed, Aug 22, 2012 at 6:45 PM, Scott González scott.gonza...@gmail.com
 wrote:

 On Wed, Aug 22, 2012 at 6:34 PM, Dan Milon danmi...@gmail.com wrote:

 Isaac, i am curious why you believe fs.exists should stay as is.


 https://groups.google.com/forum/#!msg/nodejs/oqlT9ZtUZd0/XicWJx6mC4oJ

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en



 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Mikeal Rogers
This suggested gained a lot of +1's so i want to talk about it a moment.

I don't think it's suitable to *remove* APIs that still exist from the docs or 
hide them from being enumerable.

There are just too many node programs out there now and people who want to 
understand existing code need to read the documentation for an API that *is 
still active* should be able to find and view it and to debug that API via test 
code in the repl which making non-enumerable makes annoying.

This just isn't the grown up way to handle a mistake or a deprecation. 

We need to call out in the docs that 1) this exists and is still available 2) 
it should not be used 3) why it should not be used and links to doing things 
the right way. Pretending it doesn't exist when it still does is like 
pretending we never made this mistake even though it still works in node. Let's 
take responsibility for this and do what's best for all of the existing and 
future users of node.

-Mikeal

On Aug 20, 2012, at August 20, 20128:53 AM, Tim Caswell t...@creationix.com 
wrote:

 How about removing it from the docs and making it non-enumerable in
 the fs module.  Then any new developers won't know it's there unless
 they are reading someone else's code.  Or maybe in the docs simply say
 that it shouldn't be used and is only left there so as to not break
 old code.  Also, how is this different from deprecation?
 
 On Sun, Aug 19, 2012 at 4:02 PM, Bert Belder bertbel...@gmail.com wrote:
 On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote:
 
 Maybe a note in the docs tell people that fs.stat is a better choice?
 
 Good idea Mikeal. Deprecation console.error  pointing people to
 fs.stat in the docs should do the trick.
 
 
 I don't see enough compelling reasons to deprecate it. I think a doc
 addition that warns people about the funky signature and the anti-pattern
 would suffice.
 
 - Bert
 
 
 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
 
 -- 
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-20 Thread Tim Caswell
How about removing it from the docs and making it non-enumerable in
the fs module.  Then any new developers won't know it's there unless
they are reading someone else's code.  Or maybe in the docs simply say
that it shouldn't be used and is only left there so as to not break
old code.  Also, how is this different from deprecation?

On Sun, Aug 19, 2012 at 4:02 PM, Bert Belder bertbel...@gmail.com wrote:
 On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote:

  Maybe a note in the docs tell people that fs.stat is a better choice?

 Good idea Mikeal. Deprecation console.error  pointing people to
 fs.stat in the docs should do the trick.


 I don't see enough compelling reasons to deprecate it. I think a doc
 addition that warns people about the funky signature and the anti-pattern
 would suffice.

 - Bert


 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-20 Thread Arnout Kazemier
I really dont get why people want to depricate functions just because they dont 
agree with the api signature.

This is a useful function, it doesnt hurt anyone if we keep it, but it does 
hurt when its removed.

On 20 aug. 2012, at 17:53, Tim Caswell t...@creationix.com wrote:

 How about removing it from the docs and making it non-enumerable in
 the fs module.  Then any new developers won't know it's there unless
 they are reading someone else's code.  Or maybe in the docs simply say
 that it shouldn't be used and is only left there so as to not break
 old code.  Also, how is this different from deprecation?
 
 On Sun, Aug 19, 2012 at 4:02 PM, Bert Belder bertbel...@gmail.com wrote:
 On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote:
 
 Maybe a note in the docs tell people that fs.stat is a better choice?
 
 Good idea Mikeal. Deprecation console.error  pointing people to
 fs.stat in the docs should do the trick.
 
 
 I don't see enough compelling reasons to deprecate it. I think a doc
 addition that warns people about the funky signature and the anti-pattern
 would suffice.
 
 - Bert
 
 
 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
 
 -- 
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-20 Thread Mikeal Rogers
Because we spend a lot of time convincing library authors not to defect from 
the standard callback signature. Diverging from it in core sends the wrong 
message.

On Aug 20, 2012, at August 20, 20128:59 AM, Arnout Kazemier i...@3rd-eden.com 
wrote:

 I really dont get why people want to depricate functions just because they 
 dont agree with the api signature.
 
 This is a useful function, it doesnt hurt anyone if we keep it, but it does 
 hurt when its removed.
 
 On 20 aug. 2012, at 17:53, Tim Caswell t...@creationix.com wrote:
 
 How about removing it from the docs and making it non-enumerable in
 the fs module.  Then any new developers won't know it's there unless
 they are reading someone else's code.  Or maybe in the docs simply say
 that it shouldn't be used and is only left there so as to not break
 old code.  Also, how is this different from deprecation?
 
 On Sun, Aug 19, 2012 at 4:02 PM, Bert Belder bertbel...@gmail.com wrote:
 On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote:
 
 Maybe a note in the docs tell people that fs.stat is a better choice?
 
 Good idea Mikeal. Deprecation console.error  pointing people to
 fs.stat in the docs should do the trick.
 
 
 I don't see enough compelling reasons to deprecate it. I think a doc
 addition that warns people about the funky signature and the anti-pattern
 would suffice.
 
 - Bert
 
 
 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
 
 -- 
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
 
 -- 
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-20 Thread Stewart Mckinney
Yeah, I couldn't agree with Dan more. Consistency is super important,
especially for a core lib. I mean, it could be worse, b ut, it should be
addressed rather than ignored.

On Mon, Aug 20, 2012 at 6:37 PM, Dan Milon danmi...@gmail.com wrote:

 Thats what PHP thought about deprecation also. See where this got them.


 On Mon, Aug 20, 2012 at 6:59 PM, Arnout Kazemier i...@3rd-eden.comwrote:

 I really dont get why people want to depricate functions just because
 they dont agree with the api signature.

 This is a useful function, it doesnt hurt anyone if we keep it, but it
 does hurt when its removed.

 On 20 aug. 2012, at 17:53, Tim Caswell t...@creationix.com wrote:

  How about removing it from the docs and making it non-enumerable in
  the fs module.  Then any new developers won't know it's there unless
  they are reading someone else's code.  Or maybe in the docs simply say
  that it shouldn't be used and is only left there so as to not break
  old code.  Also, how is this different from deprecation?
 
  On Sun, Aug 19, 2012 at 4:02 PM, Bert Belder bertbel...@gmail.com
 wrote:
  On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote:
 
  Maybe a note in the docs tell people that fs.stat is a better
 choice?
 
  Good idea Mikeal. Deprecation console.error  pointing people to
  fs.stat in the docs should do the trick.
 
 
  I don't see enough compelling reasons to deprecate it. I think a doc
  addition that warns people about the funky signature and the
 anti-pattern
  would suffice.
 
  - Bert
 
 
  --
  Job Board: http://jobs.nodejs.org/
  Posting guidelines:
  https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
  You received this message because you are subscribed to the Google
  Groups nodejs group.
  To post to this group, send email to nodejs@googlegroups.com
  To unsubscribe from this group, send email to
  nodejs+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/nodejs?hl=en?hl=en
 
  --
  Job Board: http://jobs.nodejs.org/
  Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
  You received this message because you are subscribed to the Google
  Groups nodejs group.
  To post to this group, send email to nodejs@googlegroups.com
  To unsubscribe from this group, send email to
  nodejs+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/nodejs?hl=en?hl=en

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en


  --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-19 Thread Robert Gould
Node has broken backwards compatibilty before and will in the futre, why not 
just deprecate fs.exists and remove it in 0.9? As THE black sheep in node.js it 
does more hurt by being there, then not being there. Not needed and not much 
use beyond being an insider joke for people that have been around from the start

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-19 Thread Bruno Jouhier
+1.

It already got moved from path to fs and people did adjust to the 
change. Why not shake it one more time and fix it (or remove it)?

On Sunday, August 19, 2012 12:01:54 PM UTC+2, Robert Gould wrote:

 Node has broken backwards compatibilty before and will in the futre, why 
 not just deprecate fs.exists and remove it in 0.9? As THE black sheep in 
 node.js it does more hurt by being there, then not being there. Not needed 
 and not much use beyond being an insider joke for people that have been 
 around from the start

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-19 Thread Nathan Rajlich
I'd be more inclined to just remove it. Use fs.stat() instead, or even
better just *do* whatever it is with the file that you're trying to
do. Checking for file existence is an anti-pattern.

On Sun, Aug 19, 2012 at 4:04 AM, Bruno Jouhier bjouh...@gmail.com wrote:
 +1.

 It already got moved from path to fs and people did adjust to the
 change. Why not shake it one more time and fix it (or remove it)?


 On Sunday, August 19, 2012 12:01:54 PM UTC+2, Robert Gould wrote:

 Node has broken backwards compatibilty before and will in the futre, why
 not just deprecate fs.exists and remove it in 0.9? As THE black sheep in
 node.js it does more hurt by being there, then not being there. Not needed
 and not much use beyond being an insider joke for people that have been
 around from the start

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-19 Thread Isaac Schlueter
We are not going to remove fs.exists.

On Sunday, August 19, 2012, Nathan Rajlich wrote:

 I'd be more inclined to just remove it. Use fs.stat() instead, or even
 better just *do* whatever it is with the file that you're trying to
 do. Checking for file existence is an anti-pattern.

 On Sun, Aug 19, 2012 at 4:04 AM, Bruno Jouhier 
 bjouh...@gmail.comjavascript:;
 wrote:
  +1.
 
  It already got moved from path to fs and people did adjust to the
  change. Why not shake it one more time and fix it (or remove it)?
 
 
  On Sunday, August 19, 2012 12:01:54 PM UTC+2, Robert Gould wrote:
 
  Node has broken backwards compatibilty before and will in the futre, why
  not just deprecate fs.exists and remove it in 0.9? As THE black sheep in
  node.js it does more hurt by being there, then not being there. Not
 needed
  and not much use beyond being an insider joke for people that have been
  around from the start
 
  --
  Job Board: http://jobs.nodejs.org/
  Posting guidelines:
  https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
  You received this message because you are subscribed to the Google
  Groups nodejs group.
  To post to this group, send email to nodejs@googlegroups.comjavascript:;
  To unsubscribe from this group, send email to
  nodejs+unsubscr...@googlegroups.com javascript:;
  For more options, visit this group at
  http://groups.google.com/group/nodejs?hl=en?hl=en

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.comjavascript:;
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com javascript:;
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-19 Thread Mikeal Rogers
Changing it's signature without renaming or moving it is worse than removing. 
It would break more code and in a way that is harder to detect.

It has a funky signature, which means you can't use most flow control libraries 
with it, but we can avoid issues by simply pointing people at fs.stat. Maybe a 
note in the docs tell people that fs.stat is a better choice?

-Mikeal

On Aug 19, 2012, at August 19, 201211:02 AM, Isaac Schlueter i...@izs.me 
wrote:

 We are not going to remove fs.exists.
 
 On Sunday, August 19, 2012, Nathan Rajlich wrote:
 I'd be more inclined to just remove it. Use fs.stat() instead, or even
 better just *do* whatever it is with the file that you're trying to
 do. Checking for file existence is an anti-pattern.
 
 On Sun, Aug 19, 2012 at 4:04 AM, Bruno Jouhier bjouh...@gmail.com wrote:
  +1.
 
  It already got moved from path to fs and people did adjust to the
  change. Why not shake it one more time and fix it (or remove it)?
 
 
  On Sunday, August 19, 2012 12:01:54 PM UTC+2, Robert Gould wrote:
 
  Node has broken backwards compatibilty before and will in the futre, why
  not just deprecate fs.exists and remove it in 0.9? As THE black sheep in
  node.js it does more hurt by being there, then not being there. Not needed
  and not much use beyond being an insider joke for people that have been
  around from the start
 
  --
  Job Board: http://jobs.nodejs.org/
  Posting guidelines:
  https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
  You received this message because you are subscribed to the Google
  Groups nodejs group.
  To post to this group, send email to nodejs@googlegroups.com
  To unsubscribe from this group, send email to
  nodejs+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/nodejs?hl=en?hl=en
 
 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en
 
 -- 
 Job Board: http://jobs.nodejs.org/
 Posting guidelines: 
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-19 Thread Nuno Job
 Maybe a note in the docs tell people that fs.stat is a better choice?

Good idea Mikeal. Deprecation console.error  pointing people to
fs.stat in the docs should do the trick.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-19 Thread Bert Belder
On Sunday, August 19, 2012 8:23:53 PM UTC+2, Nuno Job wrote:

  Maybe a note in the docs tell people that fs.stat is a better choice? 

 Good idea Mikeal. Deprecation console.error  pointing people to 
 fs.stat in the docs should do the trick. 


I don't see enough compelling reasons to deprecate it. I think a doc 
addition that warns people about the funky signature and the anti-pattern 
would suffice.

- Bert
 

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-18 Thread dhruvbird


On Friday, August 17, 2012 6:49:14 PM UTC-7, Jimb Esser wrote:

 In actuality, fs.exists *only* has an err argument... or really a not 
 err argument.  fs.exists is just not fs.stat.  If you want fs.exists 
 to have an error as the first argument, do my_fs_exists = fs.stat, and 
 it'll have exactly the same results (though will be slightly faster).

 But, yeah, slightly awkwardly different signature, though the err 
 argument of an exists query is basically meaningless, and exists was 
 not originally part of the fs module, so it's understandable.


I don't think it's meaningless.
If the fs returns an I/O error, you can't say that the file doesn't exist.


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


[nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-17 Thread Alexey Petrushin
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!);});

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-17 Thread Joshua Holbrook
Look at the sauce for fs.exists. I think you'll find it enlightening.

(tl;dr: use fs.stat instead.)

--Josh

On Fri, Aug 17, 2012 at 3:57 PM, Alexey Petrushin
alexey.petrus...@gmail.com 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!);
 });

 --
 Job Board: http://jobs.nodejs.org/
 Posting guidelines:
 https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
 You received this message because you are subscribed to the Google
 Groups nodejs group.
 To post to this group, send email to nodejs@googlegroups.com
 To unsubscribe from this group, send email to
 nodejs+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/nodejs?hl=en?hl=en



-- 
Joshua Holbrook
Head of Support
Nodejitsu Inc.
j...@nodejitsu.com

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-17 Thread Alexey Petrushin
Looking at source doesn't enlightened me. I don't see why unimportant 
internal implementation details should affect public interface. Especially 
if it's makes API inconsistent.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-17 Thread Jimb Esser
In actuality, fs.exists *only* has an err argument... or really a not err 
argument.  fs.exists is just not fs.stat.  If you want fs.exists to 
have an error as the first argument, do my_fs_exists = fs.stat, and it'll 
have exactly the same results (though will be slightly faster).

But, yeah, slightly awkwardly different signature, though the err 
argument of an exists query is basically meaningless, and exists was 
not originally part of the fs module, so it's understandable.

On Friday, August 17, 2012 4:19:34 PM UTC-7, Alexey Petrushin wrote:

 Looking at source doesn't enlightened me. I don't see why unimportant 
 internal implementation details should affect public interface. Especially 
 if it's makes API inconsistent.


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-17 Thread Alexey Petrushin
Hmmm, if it's implemented in such a way in order to be backward compatible 
- can it be changed to something like:

   if (callback.length == 1) {callback(exists)} else {callback(null, 
exists)}

It will support almost all cases that use older version.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups nodejs group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en