[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread Bryan Donovan
Your example works for me. On Sunday, March 1, 2015 at 8:15:09 PM UTC-8, Aaron Martone wrote: Sorry in advance, I've been at this problem for 6 days now and have failed at every single turn on what I need to do. I simply cannot afford to waste more time, so I'm asking for help. My

[nodejs] Re: Cycle require()

2014-03-25 Thread Bryan Donovan
I might be missing the purpose of your factory, but maybe you can just implement it like this: function PluginFactory() { // } exports.PluginFactory = new PluginFactory(); As long as you don't mess with the require cache, I think that would effectively be a singleton. Maybe there are

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-09-01 Thread Bryan Donovan
(). On Tuesday, August 20, 2013 11:12:35 AM UTC-7, Bryan Donovan wrote: Thanks Scott. That's basically what I had gathered from googling around. It seems to me like it's not necessary to wrap in nextTick for most cases then. On Aug 20, 2013, at 10:58 AM, Scott González scott.g...@gmail.com wrote

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-30 Thread Bryan Donovan
On Aug 29, 2013, at 7:09 PM, Isaac Schlueter i...@izs.me wrote: On Thu, Aug 29, 2013 at 11:19 AM, Bryan Donovan brdono...@gmail.com wrote: Thanks, I just wanted to make sure my understanding was correct in that there really is no problem with the specific case I presented

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-30 Thread Bryan Donovan
Yeah, I really dislike this pattern. It's confusing at best. I never understood the reason for designing an API this way. I suspect it has something to do with emitting events, like in the http module. On Aug 30, 2013, at 9:48 AM, Paul pseld...@gmail.com wrote: That means never doing

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-29 Thread Bryan Donovan
Thanks for the post, Isaac. Very helpful. I totally understand the logic of being consistent -- I'm known to be ruthless about consistency at work. I'm changing my public node.js libraries to use nextTick() instead of calling back immediately. However, I'm still unsure of when someone would

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-29 Thread Bryan Donovan
That's not the same situation though. What bad can happen in my most recent example? On Aug 29, 2013, at 9:57 AM, Scott González scott.gonza...@gmail.com wrote: On Thu, Aug 29, 2013 at 12:51 PM, Bryan Donovan brdono...@gmail.com wrote: However, I'm still unsure of when someone would ever

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-29 Thread Bryan Donovan
. Nobody is denying that. But it's irrelevant if it's also possible to construct situations that do have problems. On Thu, Aug 29, 2013 at 1:50 PM, Bryan Donovan brdono...@gmail.com wrote: That's not the same situation though. What bad can happen in my most recent example? On Aug 29, 2013

Re: [nodejs] Re: Downside to not wrapping sync callbacks in nextTick()?

2013-08-23 Thread Bryan Donovan
order of a callback is unnecessary in most cases, so it's an overhead that should be avoided by default. 3) Definitely DO NOT use nextTick for error handling code, because it throws away the stack information for nothing. -Chaoran On Tuesday, August 20, 2013 12:47:22 PM UTC-5, Bryan Donovan

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-23 Thread Bryan Donovan
This is certainly only way I've ever programmed in node.js. I really don't like APIs like this: var client = connect(function() { client.do_something(function() { //.. }); }); … they're just weird. This makes a lot more sense to me:

Re: [nodejs] Re: Downside to not wrapping sync callbacks in nextTick()?

2013-08-22 Thread Bryan Donovan
González scott.gonza...@gmail.com wrote: The success case is synchronous. It looks like there's nothing that ever needs to be async in that function. Why does this take a callback instead of just returning a boolean? On Thu, Aug 22, 2013 at 2:08 PM, Bryan Donovan brdono...@gmail.com

Re: [nodejs] Re: Downside to not wrapping sync callbacks in nextTick()?

2013-08-22 Thread Bryan Donovan
put the success case inside a nextTick() as well, but then you're taking an unnecessary hit everywhere, not just on error. On Thu, Aug 22, 2013 at 2:30 PM, Bryan Donovan brdono...@gmail.com wrote: Because the calling code calls back with the error (e.g., https://github.com/BryanDonovan

Re: [nodejs] Re: Downside to not wrapping sync callbacks in nextTick()?

2013-08-21 Thread Bryan Donovan
. IMO. On Tuesday, 20 August 2013 19:47:22 UTC+2, Bryan Donovan wrote: I have been writing node.js client code for a couple of years now, and have authored a couple open source libraries, but somehow I missed the memo telling me that I'm supposed to wrap 'synchrounous' callbacks

Re: [nodejs] Re: Downside to not wrapping sync callbacks in nextTick()?

2013-08-21 Thread Bryan Donovan
someone uses them in a strange way. Thanks again, Bryan On Aug 21, 2013, at 5:33 AM, Scott González scott.gonza...@gmail.com wrote: https://groups.google.com/d/msg/nodejs/FNsM6Ns1MkE/4Ys-l1RI0Q0J On Wed, Aug 21, 2013 at 4:19 AM, Bryan Donovan brdono...@gmail.com wrote: Thanks

[nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-20 Thread Bryan Donovan
I have been writing node.js client code for a couple of years now, and have authored a couple open source libraries, but somehow I missed the memo telling me that I'm supposed to wrap 'synchrounous' callbacks in process.nextTick(). I kind-of understand why that is a best-practice, but what I

Re: [nodejs] Downside to not wrapping sync callbacks in nextTick()?

2013-08-20 Thread Bryan Donovan
, 2013 at 1:47 PM, Bryan Donovan brdono...@gmail.com wrote: I have been writing node.js client code for a couple of years now, and have authored a couple open source libraries, but somehow I missed the memo telling me that I'm supposed to wrap 'synchrounous' callbacks in process.nextTick(). I

Re: [nodejs] Async testing with nodeunit

2012-05-17 Thread Bryan Donovan
What does svr.login() look like? On May 17, 2012, at 4:50 AM, Osher El-Netanany wrote: Hi all I'm trying to use nodeunit for asynchronous testing, my code is like: var svr = require(mysvr) ; svr.listen(5353); module.exports = { login: function(is) { svr.login( {

Re: [nodejs] Any way to do benchmark of http handlers for request and response without send request?

2012-04-22 Thread Bryan Donovan
Seems like you could use http://benchmarkjs.com/ and pass in mock/fake objects to the handler functions. Sent from an iPhone. On Apr 22, 2012, at 9:41 AM, jason.桂林 guil...@gmail.com wrote: I am writing a project named 'kickstart' aim to create high performance web APP template (not view

Re: [nodejs] Any way to do benchmark of http handlers for request and response without send request?

2012-04-22 Thread Bryan Donovan
P.s., if you write unit tests for this same code, I think the answer will emerge on its own :). I personally like mocha for tests. Sent from an iPhone. On Apr 22, 2012, at 9:41 AM, jason.桂林 guil...@gmail.com wrote: I am writing a project named 'kickstart' aim to create high performance web