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

2010-01-23:

[0:25] <ashb> http://github.com/ashb/jsgi-vhost/fast_forward
[0:26] <kriszyp> nice ashb
[0:29] <ashb> had a need for it
[0:30] <ashb> figured it would be useful enough
[0:34] <kriszyp> not questioning your code, but I am kind of wondering about the efficiency of all of these one-module packages
[0:34] <kriszyp> lot of extra search paths potentially...
[0:35] <ashb> i dont have extra search paths
[0:36] <ashb> i just use symlinks to symlink things in for now
[0:36] <hevalbaranov> hi everyone. I've been working on a new library that focuses on asynchronous,event driven programming. I want to get some critiques ? barf
[0:37] <ashb> kriszyp: which is an argument for a 'main' module. if only the main module is in the search path (via a symlink which is canonicalized) it makes things a bit easier pref wise doesn't it?
[0:37] <hevalbaranov> (sorry, copy paste accident)
[0:37] <hevalbaranov> hi everyone. I've been working on a new library that focuses
[0:37] <hevalbaranov> onasynchronous, event driven programming. I want to get some critiques about
[0:37] <hevalbaranov> it, could you take a look at this demo: http://gist.github.com/283549
[0:38] <hevalbaranov> ah, curses client of weechat sucks at copy paste
[0:39] <ashb> heh
[0:40] <hevalbaranov> all kind of opinions and suggestions are welcome
[0:41] <ashb> line 13 looks odd
[0:42] <ashb> hevalbaranov: beyond superficial code issues - what does it do?
[0:44] <hevalbaranov> line 13 checks whether the module is defined
[0:45] <hevalbaranov> in this example, i inserted a nested xslt layout to window.
[0:45] <hevalbaranov> look at the latest lines
[0:45] <ashb> var exports = this.exports = exports
[0:47] <hevalbaranov> yeah, it should be like this to be compatible with web and serverside
[0:50] <hevalbaranov> let me explain more this line
[0:50] <hevalbaranov> this variable indicates the module.when you try to exports property of the module
[0:51] <hevalbaranov> accessor of the module is ran. in web, exports is undefined, so, the accessor defines new object.
[0:53] <ashb> hevalbaranov: you've done var exports = exports;
[0:53] <ashb> thats what i'm pointing out
[0:57] <hevalbaranov> ashb: right. i thought that first exports will get value of this.exports
[0:58] <ashb> i'd've thought that var exports and this.exports would both end up as undef
[0:59] <ashb> since the var exports is already in scope when they run
[0:59] <ashb> var exports is scoped to the entire function, not to the line its up
[1:03] <hevalbaranov> are there any implementation that provides support for serverside and web?
[1:19] <ashb> kriszyp: ruby/gems seems to not have trouble with lots of packages installed - how does it work?
[1:23] <tlrobinson> ashb: not sure if it's intentional or not but i like how you can give it a JSGI app that uses the jackup (and others?) convention of exporting the app as "app"
[1:24] <tlrobinson> i.e. passing vhoster this would work: { "site1.co.uk": require("site1"), "site2.co.uk": require("site2") }
[1:25] <tlrobinson> as long as site1 and site2 modules use the .app convention
[1:25] <ashb> tlrobinson: happy coincednce :)
[1:25] <ashb> but i use the .app convention in the juice scaffold apps too
[1:26] <tlrobinson> hopefully that becomes *the* convention
[1:26] <ashb> it makes sense
[1:26] <ashb> tho juice exports .juice too so you can play about with it more if you need/want too
[1:26] <ashb> but .app is a JSGI compatible function for the default case
[1:27] <tlrobinson> what is the juice export?
[1:28] <ashb> its the Juice.Application subclass
[1:30] <ashb> lets me load the same 'app' twice with different config etc.
[19:28] <tlrobinson> if anyone wants a good example of why i dislike only having async APIs: http://github.com/creationix/haml-js/blob/master/test/test.js
[19:28] <tlrobinson> compare to http://github.com/creationix/haml-js/blob/master/test/test-commonjs.js
[19:28] <tlrobinson> the latter is far less convoluted
[19:29] <tlrobinson> and theres no good reason for testing code like this to be async
[19:29] <tlrobinson> /rant
[19:31] <joshthecoder> but javascript HAS to be async ALWAYS
[19:32] <joshthecoder> /sarcasm
[19:33] <tlrobinson> joshthecoder: haha i figured
[19:33] <tlrobinson> you need... SarcMark! http://www.telegraph.co.uk/technology/news/6995354/Sarcasm-punctuation-mark-aims-to-put-an-end-to-email-confusion.html
[19:33] <tlrobinson> only $1.99!
[19:33] <joshthecoder> I have to agree there's times when I don't want to use a bloody callback
[19:33] <joshthecoder> just do your stuff and get back to me when done
[19:35] <joshthecoder> lol is that a joke or what
[19:35] <tlrobinson> i think its for real
[20:34] <ondras> hm
[20:34] <ondras> guys
[20:34] <ondras> why do we need ByteString when we have ByteArray?
[20:34] <ondras> it is a heretic idea, but I vote for having only the mutable variant - and preferrably renamed just to "Binary" :)
[20:38] <ashb> ondras: ryah wants somewhere the middle. muttable content, but fixed length :)
[20:38] <ondras> hehe
[20:38] * ondras wants also another thing
[20:38] <ondras> byteArray[byteArray.length + n] = 123
[20:38] <ondras> this should not throw imho
[20:38] <ondras> but just expand appropriately
[20:38] <ondras> and zerofill
[20:39] <ondras> I see no reason for being able to resize BA's with .length and not [[set]]
[20:40] <ashb> ondras: fwiw, hippo used to only have a Blob that was mutable like ByteArray is
[20:40] * ondras will maybe create a binary/B-Lite proposal
[20:40] <ondras> with only Binary
[20:40] <ondras> based on current ByteArray
[20:40] <ondras> with some methods removed, cause they are plain evil
[20:40] <ashb> i'm not sure current Byte array is the right form
[20:41] <ashb> yeah
[20:41] <ashb> should look at how /E compares in that regard
[20:41] <ondras> copy, fill, ...
[20:41] <ondras> /E is imho very similar to /B
[20:42] <ashb> it is, but i think it removes a lot of the cruft
[20:42] <ondras> imho not enough
[20:42] <ondras> there is copy
[20:42] <ondras> + new copyFrom
[20:42] <ashb> i've not looked in detail
[20:42] <ondras> there is fill
[20:42] <ondras> there is .Content
[20:42] <ondras> all the stuff that I do not want :)
[20:43] <ashb> .Content i fail to see the point of ever
[20:43] <ondras> exactly.
[20:43] <ondras> moreover, there are at least 5 ways of doing the same stuff
[20:43] <ondras> => php way!
[20:43] <ashb> even when [[Get]] returned something else i didn't see the point of it
[20:43] <ondras> ByteArray.prototype.byteStringAt()
[20:44] <ondras> omg
[20:45] <ashb> http://github.com/ruediger/flusspferd/blob/v0.5/src/spidermonkey/blob.jsdoc
[20:45] <ashb> thats the docs for our old blob class
[20:45] <ashb> pre serverjs as it then was
[20:45] <ondras> hmhm
[20:45] <ashb> pretty damn minimal :)
[20:45] <ondras> Array like access. Cannot change the length of the blob.
[20:45] <ondras> why is this forbidden
[20:46] <ondras> it makes perfect sense to resize via assignment
[20:46] <ashb> dunno - it got changed
[20:46] <ondras> js arrays do exactly the same
[20:46] <ashb> blame MrN
[20:46] <ondras> hmhm
[20:46] <ondras> enough ranting, time to go to bed
[20:46] <ondras> gnite
[20:47] <ashb> :)(
[21:24] <tlrobinson> immutable ByteString allows for efficient slicing, etc
[21:25] <tlrobinson> though copy on write might be good enough
[21:26] <tlrobinson> i don't know... what do other languages typically offer

 

 

Logs by date :