What are you attempting to do with this?
- Nick
On May 22, 2010 9:29 PM, "Kris Kowal" <kris....@cixar.com> wrote:
On Sat, May 22, 2010 at 3:46 PM, Drew Miller <e...@anglicangeek.com> wrote:
> I need to get the argum...
No. Also, bear in mind that JavaScript engines vary on how toSource a
function so doing this generally is even harder, and sometimes
impossible.
Kris Kowal
--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To po...
Of course; I would expect no less than honest and forthright advice, had I solicited it. :)
Sent from my iPhone
Hey, if you want to plant grass on your carpet, more power to you. If
you ask me to tell you, in my design opinion, the best way to make it
grow, I'm going to advise you against the whole project.
On Sun, May 23, 2010 at 11:47, Drew Miller <e...@anglicangeek.com> wrote:
And, who does it hurt? This fx is for me, and I don't expect anyone else to
use it. If I'm wrong, there will be pain and friction in my code and I'll
change.
I've never understood why people have strong reactions to trivial or
inconsequential matters. :)
It's because we programmers are a loving sort, and wish to spare you
that friction and pain. Also, we're opinionated jerks. So you can
pick whichever explanation you like better. :)
Sometimes you just need to do the crazy thing. I get that. Rock on.
Have you considered that this approach means you cannot use
v8::FunctionHandles from C++land as handlers?
--i
--
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.
If we're going to spend lots of time in a framework, why not freshen it up? Starting at ugly code all day is bad for the soul.
webFx.handle("/a/static/path", function(request) { //... }
webFx.handle("a/route/with/:param, function(param) { // I don't need a request object }
webFx.handle("a/route/with/:param, function(param, request, user) { // I need the authenticated user }
webFx.handle("a/route/with/:param, function(session, param, user) { // I want session state, and order shouldn't matter }
webFx.handle("a/route/with/:param, function(session, param, user, someObjectIRegisteredViaDependyInjection) { // objects can come from many sources }
redundant statement :)
btw, +1 in the "holy hell, don't do it that way" camp. At first glance it looks like you're saying you'd rather parse a function each call than create an object each call, which sounds like an overhead-negative equation to me (also the fact that you wouldn't necessarily have to create the object each call if it's a repetitive call whose options can be cached up a level or two). That's not the only reason not to do it, of course, as already explained by others. Finally, I understand the "this is how I'm gonna do it anyway so stop trying to tell me not to" mindset as we all do that from time to time; just chiming in to debate-of-the-day. As Isaac said, rock on (with your crazy ass self).
If we're going to spend lots of time in a framework, why not freshen it up? Starting at ugly code all day is bad for the soul.Making your code brittle is not really freshening it up. This is one of those things you think is a good idea today, implement it, and then 6 months later forget you did it and wonder why some new thing you're doing isn't working how you expect. It's not something you'd want to release to anyone else either, even with good documentation on the major gotchas associated with it: "btw, to anyone using this, make sure you name your function arguments like this..."... blech.
webFx.handle("/a/static/path", function(request) { //... }webFx.handle("a/route/with/:param, function(param) { // I don't need a request object }webFx.handle("a/route/with/:param, function(param, request, user) { // I need the authenticated user }webFx.handle("a/route/with/:param, function(session, param, user) { // I want session state, and order shouldn't matter }webFx.handle("a/route/with/:param, function(session, param, user, someObjectIRegisteredViaDependyInjection) { // objects can come from many sources }For the love of everything holy, just make webFx.handle accept a config object. Or not :)
--
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.
I'm building something that accommodates the app I'm building in a way that *I* like, for *me.*
Hate to continue flaming this but, you know, i kinda have to :P
JavaScript doesn't have this level of introspection and that is
intentional it's not an oversight or a bug.
Don't build APIs that depend on features a language doesn't have, it's
a very bad practice. Write an API for JavaScript the way JavaScript
supports it, not something that looks like Python/Ruby.
Hate to continue flaming this but, you know, i kinda have to :P
JavaScript doesn't have this level of introspection and that is
intentional it's not an oversight or a bug.
Don't build APIs that depend on features a language doesn't have, it's
a very bad practice. Write an API for JavaScript the way JavaScript
supports it, not something that looks like Python/Ruby.
I bet you're all Apple-sympathizers, too!
Lovely thread ;)
Allow me to barge in, why not pass a plain object as argument? You get
the same result but "namespaced" (which looks nicer to me):
webFx.handle("a/route/with/:param, function(request) {
// request.user, request.param, request.session...
});
cheers,
Cap. Obvious
ps: I guess Drew will think twice before revealing his ideas next
time.