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

2010-01-11:

[7:39] <ondras> jmerlin: yes :)
[13:47] <olivvv> hi. Is there ssjs hosting solutions available ?
[13:51] <ashb> smart.joyent.com is the closests that i know of
[13:51] <ashb> but its not commonjs yet
[13:51] <olivvv> thats pretty similar to aptanacloud isn't it ?
[13:51] <olivvv> I currently have a jaxer/aptanacloud account
[13:52] <olivvv> but it seems that jaxer is a living-dead now
[13:52] <ashb> its a similar idea yes
[13:52] <ashb> were you after something else?
[13:52] <olivvv> maybe something more commonjs ish
[13:53] <olivvv> and something with a plan
[13:54] <olivvv> aptana disgusts me on this, pretending not to kill jaxer, and letting it agonize...
[13:54] <ashb> so smart is open source already at least
[13:55] <ashb> i should just find the time to add commonjs require support in to it at least
[13:55] <ashb> http://github.com/joyent/smart-platform/
[13:58] <olivvv> is Smart able to handle the dom like Jaxer ?
[13:59] <ashb> oh jaxer has hte wierd thing that you write html and give a exec="server" attr doesn't it?
[13:59] <ashb> no its nothing like that
[14:00] <olivvv> yes there is a runat attribute
[14:00] <olivvv> which isnt bad imo
[14:03] <olivvv> Fits to my quest for systems that absolute noobs could use
[14:11] <olivvv> fantastic, aptana has locked the forums
[14:13] <olivvv> Maybe I was the only customer
[14:41] <olivvv> ashb: no plans for a juicejs hosting ?
[14:41] <ashb> olivvv: maybe. morel ikely is i'll get it working on smart
[14:42] <olivvv> mmmh interesting
[14:42] <olivvv> so it will get the dom ?
[14:42] <olivvv> you told me last year you were developing the dom part
[14:42] <ashb> yeah - thats done
[14:42] <ashb> XML dom level 2 core
[14:42] <ashb> (so not the HTML part of the dom yet, i.e. no innerHTML)
[14:43] <olivvv> so jQuery not working ?
[14:43] <ashb> sizzle does
[14:43] <ashb> (sizzle being the selector engine behind jquery)
[14:43] <olivvv> ok, selection but manipulation ?
[14:43] <ashb> evilstreak: you've not tried jquery directly yet have you?
[14:44] <evilstreak> nope
[14:44] <evilstreak> the first aim was for extracting data
[14:44] <evilstreak> not manipulating and outputting
[14:44] <evilstreak> so all we needed was parsing and sizzle
[14:44] <ondras> ashb: do you have xslt?
[14:44] <ashb> the library has it, but i've not bound it to JS yet
[14:44] <ondras> ah, ok
[14:44] <ondras> libxml?
[14:44] <ashb> arabica
[14:45] <ashb> it wraps libxml, expat, xerces or msxml
[14:45] <ondras> nice
[14:45] <ondras> so you parse a tag soup?
[14:45] <ondras> *can
[14:46] <ashb> yes
[14:46] <ashb> that was an absolute requirement
[14:46] <ondras> okay
[14:56] <olivvv> So will the html dom be available next ?
[14:58] <ashb> olivvv: perhaps. not sure if i've got time to work much on that part
[15:00] <olivvv> its a killer feature
[15:00] <ashb> i might work out which bits of it i need
[15:02] <evilstreak> olivvv: to what end?
[15:02] <olivvv> html + jQuery dom manipulation ====> normal humans can do web stuffs
[15:03] <olivvv> evilstreak: to me its essential, it is the main reasons why ssjs is interesting
[15:03] <evilstreak> yes, but why?
[15:03] <evilstreak> using it for what?
[15:03] <olivvv> evilstreak: code homogeneity between server and client
[15:03] <olivvv> evilstreak: using it to build the layout, the widgets, everything
[15:04] <evilstreak> using DOM manipulation to do that would drive me nuts
[15:04] <ondras> olivvv: "normal humans doing web stuffs" ~ php ? :)
[15:04] * ondras is afraid of that
[15:04] <evilstreak> give me a proper templating language any day
[15:04] <olivvv> ondras: you kindding ?
[15:04] <ondras> actually, simplicity is the reason php is now used by every kid in the town
[15:04] <ondras> (as well as client side js)
[15:05] <ashb> simplicity of deployment more than anything
[15:05] <evilstreak> ubiquity
[15:05] <evilstreak> or what ashb said, if you like to use more words than necessary
[15:05] <evilstreak> PHP is on every shared host ever
[15:05] <olivvv> ondras: php ==> settings here, settings there, safe mode stuff, and no fonction takes its params in the same order as the other
[15:05] <evilstreak> for like $0.50/month
[15:05] <evilstreak> everything else requires virtual machines
[15:05] <olivvv> ondras: that too complicated for normal people
[15:05] <ondras> olivvv: as you might have noted, I have never said that is is cool/better etc :)
[15:06] <ondras> *it is
[15:06] <ondras> olivvv: and although it is complicated, normal people use it to write crappy code
[15:06] <evilstreak> I hate to break it to you, but HTML is too complicated for "normal people"
[15:06] <olivvv> I mean I thought php is simple before
[15:06] <ondras> and the code is crappy because 1) some php features sux, 2) non-coder people are coding
[15:06] <Wes-> SOME?
[15:06] <ondras> :P
[15:07] <olivvv> but html is the common lingo
[15:07] <Wes-> I really hate the shotgun approach to language design
[15:07] <ondras> evilstreak: so by simplifying html stuff, you want even more non-it-guys to code? good luck :)
[15:07] <olivvv> there is a lot of ppl out there with 10-20 hours html education
[15:07] <evilstreak> ondras: I don't want more non IT guys
[15:08] <olivvv> we should be able to give them more than fck editor
[15:08] <evilstreak> I want to make it easier for good developers
[15:09] <olivvv> there is a growing crowd of borderline IT ppl
[15:09] <ondras> evilstreak: ah, sorry, it was olivvv's line ("normal humans can do web stuffs")
[15:09] <ondras> olivvv: I actually prefer to let certain people on the other side of border :)
[15:09] <olivvv> ondras: What do we have to offer to them currently ?
[15:10] <evilstreak> giving too much control to content editors is a Bad Idea IMO
[15:10] <evilstreak> stuff breaks
[15:10] <ondras> olivvv: not much... who is "them", exactly?
[15:12] <ondras> anyway (as it may sound egoistic); I see the main benefit of (ss|common)js in the ability to code in my favorite language, not in getting js knowledge/tools to every person around
[15:15] <evilstreak> "the ability to code in my favorite language" <-- this
[15:15] <olivvv> ondras: them ==> the non -IT savvy ppl
[15:15] <evilstreak> I can now write my web sites in JS on both sides of the aisle
[15:15] <olivvv> ondras: and currently its a shame what "we" (the industry) provide to them
[15:16] <olivvv> ondras: the best we could do in 10 years is fck editor ?
[15:16] <Wes-> "the ability to code in my favorite language" <-- PHP's goal -- for every possible value of "my"
[15:17] <olivvv> ondras: website management & creation for the ppl just sucks
[15:17] <inimino> olivvv: dreamweaver?
[15:17] <olivvv> well yes 10 years ago
[15:17] <olivvv> but it has not improved
[15:18] <inimino> olivvv: people who don't actually know HTML are never going to be able to write markup that doesn't suck, as judged by those who do
[15:18] <cpojer> evilstreak: yes
[15:18] <cpojer> thats the awesomeness
[15:18] <ondras> olivvv: I do not share your enthusiasm about offering anything to non-it savvy ppl
[15:18] <cpojer> being able to remove one language of that web development mess
[15:18] <cpojer> have the same on the client and serverside
[15:18] <olivvv> inimino: We should have had by now something as powerful and common for the web as MS word is for paper
[15:18] <cpojer> and maybe even share the same modules on both sides
[15:18] <olivvv> yes
[15:19] <cpojer> is any of you guys going to attend the fosdem in february?
[15:19] <inimino> olivvv: if you think MS Word is acceptable I have no idea where to begin
[15:19] <evilstreak> fosdem?
[15:19] <olivvv> I did not said that
[15:19] <cpojer> fosdem.org
[15:19] <cpojer> in belgium
[15:19] <ondras> Wes-: maybe also for every possible value of "code" .)
[15:19] <olivvv> I said it sucks more for the web than for paper
[15:19] <evilstreak> olivvv: I'd much rather offer content editors sensible text markup options
[15:19] <Wes-> lol
[15:19] <evilstreak> like textile or markdown or whatever (there are a million to choose from)
[15:20] <inimino> olivvv: I mean for paper
[15:20] <inimino> evilstreak: yes
[15:20] <evilstreak> anything even close to a wysiwyg editor is the start of trouble
[15:20] <olivvv> Your mother wants to build a website, what tool can you advise ?
[15:20] <olivvv> *If you
[15:20] <Wes-> a guy I know, named jaeson
[15:20] <olivvv> *if youer
[15:20] <olivvv> *if your
[15:20] <ondras> Wes-: :DDD
[15:21] <evilstreak> olivvv: I give her a wordpress install (sadly, the editor is a bit to wysiwyg for my liking)
[15:21] <olivvv> I stop typing for 5 min
[15:21] <inimino> if you want to unify things under some "easier" banner, jQuery + DOM is a bad place to start
[15:22] <olivvv> there is 10 times more ppl doing js since jQuery. it means something.
[15:22] <cpojer> yes
[15:22] <cpojer> but jquery is aimed to make the dom easier to use
[15:22] <cpojer> it is clearly not useful for anything else
[15:23] <olivvv> cpojer: $('myTable').tableSorter();
[15:23] <olivvv> any noobs can do that
[15:23] <cpojer> yes
[15:23] <olivvv> and get the expected result
[15:23] <cpojer> (mootools ftw. btw. ;) )
[15:23] <olivvv> sure
[15:24] <olivvv> Now imagine the same kind of things server-side
[15:24] <olivvv> $('stuff').blog();
[15:24] <cpojer> $('127.0.0.1').makeServer().loadWebapp() ?
[15:24] <cpojer> lol
[15:24] <evilstreak> olivvv: that causality seems a little flawed
[15:24] <olivvv> why ?
[15:25] <cpojer> consider that jquery is mostly useful for small quirks, to make something work quickly
[15:25] <evilstreak> jQuery didn't cause a 1000% increase in JS developers
[15:25] <cpojer> serverside stuff is often a lot more complex
[15:25] <evilstreak> more sites are using JS, it's becoming more commonplace everywhere
[15:25] <evilstreak> yes jQuery made it easier (but so did the libraries that came before it)
[15:25] <evilstreak> but it would have happened anyway
[15:26] <inimino> the causality is all backwards actually
[15:26] <evilstreak> true
[15:27] <inimino> it's because of all the new JavaScript interest that things like jQuery are popular
[15:29] <olivvv> imo, jQuery is uniquely successful, compared to other pieces of code in other languages
[15:30] <cpojer> olivvv: what are you trying to say btw.?
[15:30] <olivvv> I was the right thing to give to ppl with minimal knowledge
[15:30] <olivvv> to do client-side stuff
[15:31] <olivvv> I hope for the same to happend server-side
[15:31] <olivvv> server-side is not sacred
[15:31] <SubtleGradient> jQuery is awesome at filling a very specific gap
[15:32] <SubtleGradient> but it's not designed to be used for general programming
[15:32] <SubtleGradient> it's just completely outside its scope
[15:32] <evilstreak> jQuery is *very* browser oriented
[15:33] <evilstreak> even with a fully functional DOM on the server there are big chunks of it that wouldn't get used
[15:33] <SubtleGradient> on the client-side most of what you're using is the HTML + CSS. jQuery is mostly used to add a few effects or ajaxy thing. to improve what's already there
[15:33] <evilstreak> (events and effects)
[15:33] <SubtleGradient> on the server side there is nothing to start with
[15:34] <evilstreak> and whilst the DOM traversal in it is decent, I don't rate the DOM manipulation much
[15:34] <SubtleGradient> jQuery 1.4+ maybe 1.5? is going to become more module like MooTools has always been
[15:34] <evilstreak> which is why people write their own plugins for it if they're doing heavy lifting
[15:34] <cpojer> all major libraries provide abstractions for the DOM
[15:34] <SubtleGradient> then it might make sense to do a custom build without all the client-side only stuff
[15:35] <evilstreak> so you're left with basically Sizzle and a little bit of traversal stuff useful on the server
[15:35] <cpojer> in a way that makes us forget about how bad the DOM API actually is
[15:35] <SubtleGradient> having a good CSS Selector engine is absolutely necessary to modern coding. especially on the clientside
[15:35] <SubtleGradient> which is why we have been working on Slick and the SlickSpec
[15:36] <evilstreak> querySelectorAll
[15:36] <evilstreak> jobs a good'un
[15:36] <evilstreak> <_<
[15:36] <SubtleGradient> helping all selector engines become their best
[15:36] <SubtleGradient> QSA is only part of the answer
[21:24] <tlrobinson> anyone know the proper way to parse a command line command string into individual args?
[21:24] <tlrobinson> taking into account quoted args, etc
[21:24] <tlrobinson> is there a nice little regex that will do it for me
[21:24] <tlrobinson> (e.x. 'foo "bar baz"' should become ["foo", "bar baz"])
[21:25] <Dantman> heh
[21:25] <Dantman> ;) Ruby will show you that's no easy task
[21:26] <tlrobinson> hmmm
[21:26] <Dantman> Heh, wait, worse...
[21:26] <evilstreak> tlrobinson: hippo has a getopt thing, though I think it's probably done in C++
[21:27] <Dantman> I'm thinking about how bad the libraries in Ruby for building command line strings ( ;) not parsing, which is worse) are.
[21:27] <tlrobinson> i don't think that's what i want. the shell passes args as an array already
[21:27] <tlrobinson> but if i have a string with multiple args i want to split, then i need to do some slightly fancier parsing than just .split(" ")
[21:28] <evilstreak> ah
[21:28] <ashb> tlrobinson: i have a c++ version that does just that
[21:28] <ashb> if you are just after the logic
[21:29] <ashb> http://github.com/ruediger/flusspferd/blob/master/libflusspferd/modules.cpp#L737-812
[21:29] <tlrobinson> ashb: oh so you are doing the splitting yourself
[21:29] <ashb> tlrobinson: yeah for hte same use case
[21:29] <ashb> or very similar
[21:30] <ashb> in this case its for parsing a special comment line
[21:30] <ashb> //flusspferd: -I foo
[21:30] <ashb> etc
[21:30] <tlrobinson> something like RUBYOPT?
[21:30] <tlrobinson> ah
[21:30] <tlrobinson> i'm doing NARWHALOPT but same idea
[21:30] <ashb> yeah
[21:31] <tlrobinson> interesting idea though, i haven't seen the special comment approach
[21:31] <ashb> its slightly different to *OPT
[21:31] <ashb> but the main reason for that is to work arround linux's /usr/bin/env sucking
[21:31] <ashb> #!/usr/bin/env flusspferd -Ilib
[21:31] <ashb> looks for a 'flusspferd -Ilib' binary on linux
[21:32] <ashb> but works in BSD/MAC
[21:32] <SubtleGradient> lol
[21:32] <ashb> er/ mac
[21:32] <tlrobinson> right
[21:32] <ashb> also doing it that way means you can #!env commonjs
[21:32] <ashb> and then set interpreter specific commands in a comment
[21:32] <SubtleGradient> #!`which flusspferd` -llib
[21:32] <SubtleGradient> ? could that work?
[21:32] <ashb> dont think so
[21:34] <tlrobinson> ashb: do you only check the second line for the special comment, or if i added something simililar to narwhal could we include both
[21:34] <ashb> one sec - i'll find our ticket
[21:34] <ashb> it was deisnged to support arbitrarty interpeters
[21:34] <ashb> http://redmine.flusspferd.org/issues/show/152
[21:34] <ashb> which links tyo http://code.google.com/p/gpsee/issues/detail?id=12
[21:34] <ashb> which has more detail
[21:35] <ashb> Solution: Parse all leading comments with gsr; once we have a non-//
[21:35] <ashb> comment, or empty // comment, we switch to JS parser
[21:35] <ashb> i.e. keep going until you find a non // comment line or an whitepsace-only/empty comment line
[21:35] <tlrobinson> oh cool
[21:35] <tlrobinson> perhaps i should add that
[21:36] <tlrobinson> though i think we'd run into a chicken/egg issue, we parse the opts before we load the main module
[21:36] <ashb> same
[21:36] <ashb> so you can only add/change some
[21:36] <ashb> and some dont make sense fomr inside a module
[21:37] <ashb> tlrobinson: fwiw we also supoe a PEP-263 like encoding scheme
[21:37] <ashb> // -*- coding: latin-1 -*- vim: set fileencoding=latin-1 :
[21:37] <SubtleGradient> what about WScript support?
[21:37] <ashb> SubtleGradient: what about it?
[21:37] <tlrobinson> btw this seems to work, at least for simple cases: /"([^"]+)"|\s*([^"\s]+)/g
[21:37] <SubtleGradient> does that support shebang lines?
[21:38] <ashb> i doubt it
[21:38] <ashb> spidermonkey doesn't either
[21:38] <MisterN> we do it ourselves
[21:38] <ashb> my module loader turns #! to // if its the first 2 chars
[21:39] <SubtleGradient> anyone know what the current state of serverside JScript support for CommonJS is?
[21:39] <ashb> pretty non-existent
[21:39] <SubtleGradient> any JScript support in narwhal?
[21:39] <tlrobinson> (actually this doesn't work for cases like 'foo "bar \" baz"
[21:39] <tlrobinson> ')
[21:40] <tlrobinson> SubtleGradient: I think someone was working on a JScript engine for narwhal awhile ago
[21:40] <tlrobinson> not sure how far they got
[21:40] <SubtleGradient> I'd bet that most serverside ecmascript in the wild today is running on ASP or .NET
[21:41] <tlrobinson> SubtleGradient: http://groups.google.com/group/narwhaljs/search?group=narwhaljs&q=jscript&qt_g=Search+this+group
[21:41] <SubtleGradient> its support for the "htmlfile" activex is very handy.
[21:41] <SubtleGradient> any chance of something like "htmlfile" coming to narwhal or whichever?
[21:42] <ashb> what does 'htmlfile' do?
[21:42] <tlrobinson> i don't know anything about htmlfile
[21:42] <SubtleGradient> i guess there's env.js, but I'm not sure what all it can do
[21:42] <SubtleGradient> htmlfile is an IE web view, basically.
[21:42] <tlrobinson> ah
[21:42] <ashb> hippo has xml and tagsoup xml parsing + xml DOM level 2
[21:42] <SubtleGradient> like an iframe
[21:42] <tlrobinson> narwhal-jsc can run in a WebView instance
[21:42] <tlrobinson> OS X only currently though
[21:42] <SubtleGradient> cool
[21:43] <SubtleGradient> but can it arbitrarily create new webviews?
[21:43] <tlrobinson> SubtleGradient: no, but that would be neat
[21:43] <tlrobinson> probably not terribly hard either
[21:44] <tlrobinson> actually it probably can just create iframes
[21:44] <SubtleGradient> it's be awesome to have a unified api to webview, htmlfile & geckoview
[21:44] <tlrobinson> yea
[21:45] <MisterN> i don't know, do you really want a browser instance on the server?
[21:45] <SubtleGradient> I'd like that option, yes
[21:46] <ashb> so you can have activeX exploits on the server too? ;)
[21:46] <SubtleGradient> that's one of Jaxer's core abilities iirc
[21:46] <ashb> what - activex exploits?
[21:46] <SubtleGradient> imagine being able to construct a response using normal DOM methods and existing code
[21:47] <ashb> construsting content with the DOM sucks huge donkey balls
[21:47] <ashb> its such a clunky api
[21:47] <SubtleGradient> would still be very useful in the real world
[21:48] <ashb> you dont need a full webview for that tho
[21:48] <ashb> just DOM
[21:48] <SubtleGradient> sure
[21:48] <Dantman> SubtleGradient, I'd bet that most JavaScript on the server in't ASP/.NET, but CouchDB/MongoDB..... JS not ES cause iirc AS had some extra stuff I haven't researched much about.
[21:49] <SubtleGradient> Dantman: server-side JScript has been around for a very very long time
[21:50] <SubtleGradient> wasn't as popular as VBscript (for whatever reason), but still
[21:50] <Dantman> ^_^ JSON-like document databases adopting JavaScript consistently as a built in makes server-side JavaScript developments really fun.
[21:50] <Dantman> SubtleGradient, ;) so has "ssjs"
[21:51] <SubtleGradient> perhaps I am wrong
[21:51] <SubtleGradient> OT: oh, incase anyone was interested in how to implement sandboxed natives for secure modules. Checkout fusebox.
[21:51] <ashb> link?
[21:51] <SubtleGradient> looking for it
[21:51] <SubtleGradient> http://bit.ly/hello_my_name_is_fusebox
[21:52] <Dantman> aka LiveWire iirc... unless it was something else that everyone called "ssjs" a long time ago
[21:53] <SubtleGradient> fusebox implements sandboxed natives without subclassing in all browsers and on the serverside
[21:54] <SubtleGradient> so theoretically you could pass fresh natives to a module somehow so that if it tried to modify the prototype it would only work in that scope
[21:55] <ashb> bah wheres the fuckign un-minified version
[21:55] <SubtleGradient> isn't released yet.
[21:55] <SubtleGradient> should be coming out sometime this month
[21:55] <ashb> i dont fucking care - they have a deom with a fusebox.min.js
[21:55] <ashb> that means they should have a non minified version
[21:56] <SubtleGradient> i agree
[21:56] <SubtleGradient> and yet, no such luck
[21:56] <tlrobinson> SubtleGradient: i hacked together a PoC Jaxer clone with narwhal-jsc and Jack awhile ago
[21:57] <SubtleGradient> </status>
[21:57] <tlrobinson> it was bare bones but it worked
[21:57] <ashb> Today marks one year since FuseJS began development. Happy birthday to us !
[21:57] <SubtleGradient> oops, wrong channel
[21:57] <ashb> o_O and no release
[21:57] <ashb> wtf
[21:57] <SubtleGradient> tlrobinson: cool!
[21:58] <tlrobinson> SubtleGradient http://gist.github.com/274646
[21:58] <ashb> line 6 being a perfect example of wht creating with the DOM API sucks
[21:58] <tlrobinson> i call it... Jacker!
[21:58] <tlrobinson> hehe
[21:59] * tlrobinson hates the dom
[21:59] <ashb> yeah me too
[21:59] <SubtleGradient> I love the DOM since there is no alternative
[21:59] <ashb> there is always an alternative
[21:59] <tlrobinson> cappuccino ;)
[21:59] <SubtleGradient> show me one
[21:59] <SubtleGradient> :/
[21:59] <ashb> depends on what you need to do wit hit
[21:59] <SubtleGradient> websites
[22:00] <ashb> not specific enough
[22:00] <SubtleGradient> sites,? on the web
[22:01] <SubtleGradient> mostly web 1.5 sites I guess
[22:01] <ashb> Hi i'd liek to write some codez? can has help please?
[22:01] <SubtleGradient> i rarely do webapps
[22:01] <SubtleGradient> ? these days
[22:25] <Wes-> tlrobinson: arguments array in rhino not take care of that for you?
[22:26] <Wes-> tlrobinson: hint, you're not supposed to parse it, that's the shell's job
[22:26] <Wes-> tlrobinson: the shell makes argv before it calls into execvp()
[22:28] <Wes-> tlrobinson: args-in-comments, though, you can invent your own quoting syntax if you want. I haven't implemented yet, my thoughts are simply to allow one string per comment line, like this
[22:28] <Wes-> //gpsee: -f this filename has a space in it.js
[22:29] <Wes-> //gpsee: -F this_filename_has_a_quote_right_here_".js
[22:29] <Wes-> then you can avoid the whole mess
[22:29] <ashb> Wes-: NARWHALOPT="-foo --bar=baz"
[22:29] <ashb> is the problem he's trying to solve
[22:30] <Wes-> oh, that's a mildly obnoxious problem, isn't it?
[22:30] <tlrobinson> Wes-: i know
[22:30] <tlrobinson> i want the user to be able to pass in their own args string
[22:31] <tlrobinson> yeah, what ashb said
[22:31] <tlrobinson> why reinvent a syntax?
[22:31] <Wes-> don't forget, then, to support \ but not inside ', only inside "
[22:31] <Wes-> except when " is inside '
[22:32] <ashb> thats what the version i linked to does
[22:32] <Wes-> tlrobinson: when you have the freedom to do so, it sometimes makes sense. (you don't for your use-case, though)
[22:32] <ashb> tlrobinson: if you want i can port it to JS quite quickly
[22:32] <tlrobinson> i'm pretty close with a regex
[22:32] <ashb> ah
[22:43] <tlrobinson> oh jeez what i have i done http://gist.github.com/274690
[22:45] <SubtleGradient> tlrobinson: you've created something with 0 specs?
[22:46] <tlrobinson> i've got some test cases
[22:47] <tlrobinson> oops found a bug
[22:47] <SubtleGradient> i use `while(string.replace)` for my css selector parser
[22:47] <tlrobinson> need moar test cases
[22:47] <SubtleGradient> works great
[22:48] <ashb> tlrobinson: nice. char based approach would be clearer tho :D
[22:48] <SubtleGradient> .replace() makes the regex much simpler. since you only need to match from ^
[22:49] <ashb> or use /g
[22:49] <SubtleGradient> no safari2 support unfortunately
[22:49] <ashb> you dont have to worry about old browsers than IE typically
[22:49] <SubtleGradient> /g isn't as simple as you might think
[22:49] <SubtleGradient> typically, ya
[22:50] <ashb> i'm perfectly aware how to use /g
[22:50] <SubtleGradient> i'm sure you are
[22:50] <SubtleGradient> but not necessarily in the context of my particular css selector parser
[22:50] <ashb> i use it and .replace almost interchangably
[23:00] <tlrobinson> anyone care to offer other test cases: http://gist.github.com/274690
[23:03] <tlrobinson> i'm pretty sure i'm missing lots
[23:06] <ashb> foo"bar"baz
[23:06] <ashb> should be foobarbaz
[23:06] <tlrobinson> ah yeah
[23:06] <ashb> i'd sugest for clarity that you change the quotes to '
[23:06] <ashb> "hello \"world\"" -> 'hello "world"'
[23:07] <ashb> i'm not sure about your 4th test either
[23:07] <tlrobinson> in the test cases?
[23:07] <tlrobinson> well some are ' and some are "
[23:08] <ashb> $ echo hello 'wo\'rld'
[23:08] <ashb> >
[23:08] <ashb> implies line 8 is wrong
[23:08] <tlrobinson> hm
[23:09] <tlrobinson> i suppose i should run my test cases through a shell too
[23:09] <tlrobinson> test the test cases
[23:09] <ashb> if not automated then at least once, yeah good idea
[23:10] <tlrobinson> ashb: does yours handle all of these cases?
[23:10] <tlrobinson> (the correct ones)
[23:10] <ashb> no idea
[23:11] <ashb> i just blindly assumed it did
[23:11] <ashb> i didn't actually change any of the logic
[23:11] <ashb> just made it push into a JS array rather than a std::vector
[23:44] * tlrobinson is tempted to write a little fuzzer to test this damn thing
[23:48] <ashb> fuzzer?
[23:49] <inimino> something that produces semi-random output
[23:49] <ashb> ah
[23:51] <tlrobinson> ashb: yeah generate randomish args strings, run them through the shell to get the "correct" results, then compare to mine

 

 

Logs by date :