Mochabot log - CommonJS IRC channel: #commonjs on irc.freenode.net

2010-01-04:

[1:47] <SubtleGradient> in a commonjs module, does `this.exports === exports` ?
[1:48] <SubtleGradient> what happens if you `var exports = {};` in a module?
[1:48] <keeto> a beaver will drop from the sky.
[1:49] <SubtleGradient> /kick keeto
[1:49] <keeto> lol.
[1:49] <keeto> sorry subtle, can't resist a line where I could include a beaver reference. :)
[1:49] <SubtleGradient> i understand
[1:50] <SubtleGradient> tlrobinson, being the only name I recognize other than a few others: any insight? ?
[1:50] <tlrobinson> SubtleGradient: not necessarily
[1:50] <tlrobinson> "this" is purposefully left undefined in the module spec
[1:50] <tlrobinson> you shouldn't rely on it being anything in particular
[1:51] <tlrobinson> it might be the module scope, exports object, or global
[1:51] <SubtleGradient> I'm just trying to think of an elegant way to write universal javascript that will work everywhere, including as a module
[1:51] <tlrobinson> var Foo = { ... }
[1:51] <tlrobinson> if (typeof exports !== "undefined") exports.Foo = Foo;
[1:52] <tlrobinson> usually something like that
[1:52] <SubtleGradient> hmm?
[1:52] <tlrobinson> or "mixin" a bunch of properties directly into exports
[1:52] <SubtleGradient> I was thinking more along the lines of `(function(){ this.Foo = ?}).apply(exports)`
[1:53] <SubtleGradient> and at the top I could do `this.exports = this.exports || window`
[1:53] <tlrobinson> how about: var Foo = typeof "exports" === "undefined" ? {} : exports;
[1:53] <tlrobinson> err
[1:53] <tlrobinson> there are lots of ways
[1:53] <SubtleGradient> yeah
[1:54] <SubtleGradient> is there a standard commonjs way to mix all the properties/methods of a require into the current scope?
[1:54] <SubtleGradient> i.e. in a closure
[1:55] <tlrobinson> unfortunately no
[1:55] <SubtleGradient> pity
[1:55] <SubtleGradient> it should have
[1:55] <tlrobinson> we talked about having "include" in addition to "require"
[1:55] <SubtleGradient> what was the consensus?
[1:55] <tlrobinson> i think it's hard to implement cleanly
[1:56] <tlrobinson> you can do it with a "with" statement
[1:56] <tlrobinson> or interpreter-specific APIs
[1:56] <SubtleGradient> isn't that being phased out with >ES5?
[1:57] <tlrobinson> i can't remember what the exact changes are, but yeah something is changing with "with"
[1:57] <SubtleGradient> i'm going to need something like include.
[1:58] <SubtleGradient> where would I go to participate in that sort of thing?
[1:58] <tlrobinson> why do you *need* it?
[1:58] <SubtleGradient> I'm a core MooTools developer
[1:59] <SubtleGradient> I'm thinking about how best to code MooTools for the future
[1:59] <tlrobinson> the mailing list would be the right place to discuss it
[1:59] <SubtleGradient> ok, good deal
[1:59] <tlrobinson> but first you might want to go back and look at previous discussions about it
[1:59] <SubtleGradient> willdo
[2:00] <SubtleGradient> what's your impression of the commonjs process sofar?
[2:00] <SubtleGradient> are people open and such?
[2:00] <tlrobinson> it has it's ups and downs
[2:00] <tlrobinson> yes, very
[2:00] <tlrobinson> sometimes i think too much so :)
[2:01] <SubtleGradient> I haven't gotten involved before because I've seen alt.whatever.javascript
[2:01] <SubtleGradient> and I wary of such horror
[2:01] <tlrobinson> oh yeah alt.lang.javascript is awful
[2:01] <tlrobinson> err alt.comp.lang.javascript
[2:02] <SubtleGradient> MooTools doesn't have enough of a voice on these sorts of bodies
[2:02] <tlrobinson> commonjs isn't anything like that
[2:02] <tlrobinson> alt.comp.lang.javascript seems pretty irrelevant. i haven't heard of anything worthwhile going on there
[2:03] <SubtleGradient> good good
[2:04] <SubtleGradient> I tend to think of standards being like a force of nature
[2:04] <SubtleGradient> you know half of them are going to suck, and there's nothing you can do about it
[2:04] <SubtleGradient> e.g. JSON.stringify
[2:04] <tlrobinson> heh
[2:04] <tlrobinson> sometimes a crappy standard is better than no standard
[2:04] <SubtleGradient> sure
[2:04] <tlrobinson> though i'd like to think commonjs isn't crappy
[2:05] <SubtleGradient> I'm liking it sofar
[2:05] <SubtleGradient> ever hear of Espresso.app?
[2:05] <tlrobinson> yes
[2:05] <SubtleGradient> we implemented a CommonJS style require system in Spice.sugar
[2:05] <SubtleGradient> so you can extend Espresso with javascript
[2:05] <SubtleGradient> it uses CocoaJS
[2:05] <SubtleGradient> or JSCocoa
[2:05] <tlrobinson> neat
[2:05] <SubtleGradient> I'm a fan
[2:06] <tlrobinson> what's Spice.sugar?
[2:06] <SubtleGradient> tlrobinson: http://onecrayon.com/spice/
[2:06] <tlrobinson> oh i see, Spide.sugar is this JSCocoa thing
[2:07] <SubtleGradient> Espresso.app extension using JSCocoa with CommonJS style requires to extend your text editor using JavaScript
[2:07] <tlrobinson> JSCocoa is pretty awesome
[2:08] <SubtleGradient> I like it
[2:08] <tlrobinson> at one point i had narwhal working great with it. i think building it is broken at the moment though
[2:08] <SubtleGradient> I saw that.
[2:08] <SubtleGradient> I follow much of what you do
[2:08] <SubtleGradient> you must not have kids ;)
[2:08] <tlrobinson> hah nope
[2:08] <tlrobinson> nor a girlfriend :(
[2:09] <SubtleGradient> my free time is very full these days :D
[2:10] <SubtleGradient> we're working on a new standalone CSS Selector engine. And along with it an exhaustive framework-independant selector spec that Sizzle and Acme and everyone can collaborate on
[2:10] <SubtleGradient> specs ftw
[2:10] <tlrobinson> cool
[2:10] <tlrobinson> i have to admit i don't deal with CSS selectors much though
[2:11] <SubtleGradient> the style of progressive enhancement I use for the types of sites I develop relies quite heavily on them
[2:12] <tlrobinson> yeah it's certainly a good model for that style application
[2:12] <tlrobinson> not so much for something like Cappuccino
[2:12] <SubtleGradient> with webapps you tend to get more control over the full stack
[2:12] <SubtleGradient> no, not so much
[2:12] <SubtleGradient> I'm also very interested in databinding on the client-side
[2:13] <tlrobinson> a quick grep of the cappuccino source shows a total of about a dozen "getElement*" calls
[2:13] <tlrobinson> (and we don't use any sort of wrapper)
[2:14] <SubtleGradient> yeah, makes sense for cappuccinoi
[2:15] <SubtleGradient> how does cappuccino handle databinding?
[2:15] <tlrobinson> hm i wonder if there's a reason we do doc.getElementsByTagName("head")[0] instead of doc.body
[2:15] <tlrobinson> err s/head/body/
[2:53] <cadorn> tlrobinson: You mentioned ^ you had Narwhal working with JSCocoa - I am interested in getting that working again
[19:28] <Wes-> ondras: ping
[19:39] <ondras> Wes-: yessir
[19:40] <Wes-> ondras: when you use the remote debugger with v8cgi -- .... what program does it connect to?
[19:41] <ondras> Wes-: actually, this v8 features starts a tcp server listening on a given port, speaking with v8 debugging protocol
[19:42] <ondras> I believe that a d8 can be used as a client here, but I never tested...
[19:42] <ondras> s/with //
[19:42] <Wes-> ondras: right... I'm interesting in making gpsee speak this protocol, but am looking for a client first!
[19:43] <ondras> let me look for a relevant thread
[19:43] <ondras> Wes-: http://groups.google.com/group/v8-users/browse_thread/thread/25de833bcd3f1a77/b7140cdaa90f01a0?lnk=gst&q=protocol#b7140cdaa90f01a0
[19:44] <ondras> (the second message bears most information relevant to you)
[19:45] <Wes-> ondras: Thanks! But, ah, where do I download d8?
[19:46] <ondras> d8 is a part of v8 (a sample app)
[19:46] <Wes-> *AH*
[19:46] <Wes-> So I need to download v8, makes sense
[19:47] <Wes-> OH... Hey, do you know of a ready-to-install package for win32?
[19:47] <ondras> no
[19:47] <ondras> I checkout and compile v8 for win32
[19:47] <ondras> afaik there are no official packages of v8 for any platform
[19:48] <Wes-> Grr
[19:48] <Wes-> means I need to get visual studio on here
[19:49] <ondras> mingw works nice
[19:49] <ondras> (but msvc as well)
[19:50] <Wes-> True. d8 doesn't ship with chrome, does it? :)
[19:50] <ondras> I believe it does not :)
[19:51] <Wes-> Hey, how do you ship v8cgi? source-only?
[19:52] <ondras> source and win32 package
[19:53] <Wes-> Does win32 package have d8? :)
[19:53] <ondras> no, just v8.dll
[19:54] <Wes-> ah, well, it was worth a shot :)
[19:54] <ondras> true :)
[19:59] <ondras> wow, that canvas stuff is better than I thought :)
[19:59] <ondras> http://tmp.zarovi.cz/fractal/
[20:14] <Wes-> ondras: I want to see canvas implementing something like the old fracint program from the 90s
[20:14] <Wes-> *that* would be awesome
[20:15] * ondras knows only xaos
[20:16] <Wes-> fracint had this great trick where it would cycle the colour pallette
[20:16] <ondras> ah
[20:16] <Wes-> you could look at it straight and think you were taking halucinogens
[20:17] <ondras> well, coloring is one of my weakest skills :)
[20:17] <ondras> but I will work on it .)
[20:17] <Wes-> I failed colouring in grade 1
[20:17] <Wes-> mom was *pissed*
[20:17] <Wes-> (I was bored)
[20:17] <ondras> :P

 

 

Logs by date :