I know there are modules to make this easier (async, fibers, etc.)
I've used some of these, but they seem to introduce as much complexity
as they hide.
The main issue is that if it were just myself, it would be ok because
I'm used to the async way of coding. However, these scripts may have
to be maintained by others. And the async way takes a long time to
get used to.
Am I trying to fit a square peg in a hole? Is this the wrong tool to
use for such things?
For example (https://github.com/Sage/streamlinejs/blob/runtime/
examples/misc/shebang.sh):
#!/usr/bin/env node-streamline
console.log("waiting 1 second");
setTimeout(_, 1000);
console.log("done!");
If you want to try it out:
npm install streamline -g
$(streamlinedir)/examples/misc/shebang.sh
Bruno
> You can use the sync version of any APIs available.
This applies to the node core only that has a *Sync version for almost
everything. Many modules just don't care. I also wonder if having to
keep all this kind of APIs in duplicates instead of a general purpose
solution that applies to both is really the best thing, or just the
next best thing to what we can currently do.
> Sure it's not ideal, but maybe you want to write a little bash script
> instead of a node script instead?
Its really a pity if alienating fair use cases and showing people the
door just because of dogmatics.
On Dec 1, 4:51 pm, Jake Verbaten <rayn...@gmail.com> wrote:
> You can use the sync version of any APIs available.
Q: why do we need/have sync APIs?
I would not mind if node did not have any sync APIs (not even
require). At least nobody would be tempted to put a blocking call in
the middle of a module.
> Sure it's not ideal, but maybe you want to write a little bash scriptIts really a pity if alienating fair use cases and showing people the
> instead of a node script instead?
door just because of dogmatics.
But I'm the lazy kind and I write all my stuff (except require hooks :-
() with async calls! There must be some other reason!
@Raynos and Bruno JouhierCreating a good language and good supporting functionality is not about catering to what *you* like or what *you* are ok with dealing with. Its about creating easy to use, powerful functionality that can be combined in ways thatA. make new ways of doing things possible, so people can experiment and improve, andB. allow people to program and think in a way that more closely matches their programming domainBy saying "We don't need them, because people that do are lazy" shows how little you know about good design. You *should* be the lazy programmer because lazy programmers don't like doing repetitive monotonous work that drives down their productivity and creativity.The argument here is not about making every programmer write synchronous versions of every method. This is how the core 'fs' module works, and tho it's useful, its also bad design. Futures/promises are the solution to this. No one needs to write two versions of functions. Futures allow for much more maintainable code, as well as having the ability to write code in new, non-cludgy ways. Node.js was originally planning on using futures as the main concurrency scheme, but apparently the designers were overwhelmed by different dogmas as to how futures should work that they just said "fuck it" and went with callbacks, which aren't flexible but are dead simple. This was short sighted of them.
--
--
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.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.