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

2009-10-26:

[8:04] <ondras> guys, does the modules/1.1 spec say that the mainfile must be treated as a module? or is it simply implied by a common sense?
[8:04] <ondras> (or, reformulated: is there any implementation _not_ treating the mainfile as a module?)
[8:14] <ashb> ondras: i thought it used to say that. and flusspferd does since 0.7 or 0.8, and i think we were the last ones to do it
[8:50] <afonso> is this project related to mozilla foundation?
[9:38] <ashb> afonso: not directly, only in so much as there are a few mozilla people involved in this
[9:47] <ondras> ashb: okay, so v8cgi is definitely the last one not doing this :) adding to todolist...
[9:47] <ashb> ondras: cool :)
[11:51] <afonso> (not really sure if this is the right place ti ask but) do you know of a LALR(1) implementation in js? I've tried using http://jscc.jmksf.com/ but has some nasty bugs.. :\ just wanted to know before starting looking at the code
[11:54] <ashb> afonso: last time i needed a serious parse in JS i hand crafted my own recursive descent one
[11:54] <ashb> but that was early 2007
[11:55] <ashb> afonso: what kind of bugs out of interest?
[11:57] <afonso> ashb: for instance [^a] will recognize the input 'd' but [^a]+ won't :(
[11:57] <ashb> oh
[11:57] <afonso> mostly regexp not matching the input
[11:58] <afonso> i built my own bnf parser, but it kind of sucks (quick&dirty) so but this one seemed very nice!
[11:58] <afonso> but they have different "drivers" I've used the web one (meant for webpages) still going to test the v8 and rhino
[18:36] <- *humbletim* help
[19:03] <humbletim> anyone have recommendations for the easiest tools nowadays for something like automake/configure functionality? rather than generating .c files to compile and run to flush out feature support, i'll be generating .js files and running them through CLI js VMs
[19:04] <evilstreak> I think ashb is preferring premake at the moment
[19:04] <Wes--> humbletim: since you have try/catch/finally, you can do this with a single giant JS program
[19:07] <humbletim> Wes-: i like the craziness of that. however, if you check out my vdom push, monolithic detection glue can get out of hand almost immediately. i really don't want to have totally separate glue code for each evolving commonjs/VM imp, so am thinking aligning by required feature support would be better?
[19:30] <ashb> humbletim: you keep thinking commonjs will be different. if it is this whole movement has failed.
[19:31] <humbletim> ashb: i like to look at it as jumping ahead, if nothing else to help cross-check
[19:32] <Wes--> ashb: did you ever run modjs on mac/
[19:32] <ashb> Wes--: most definately
[19:32] <ashb> mac has been my dev platofmr since 2006
[19:33] <Wes--> ashb: darn. Having the wierdest problem with it, and it works fine on Linux. Behaving as the though the global object is empty (i.e. no standard classes)
[19:33] <ashb> o_O
[19:33] <ashb> that is really odd
[19:33] <ashb> using gpsee or that code as it was?
[19:33] <Wes--> yeah, tell me about it. There must be a wee bit of pointer spew or something in there
[19:34] <Wes--> ashb: with gpsee, I never ran it as-is, didn't want to download js1.7 :)
[19:34] <Wes--> ashb: And by "in there", I don't necessarily mean modjs, could just as easily be my code
[19:34] <Wes--> ashb: Even this breaks! <a>sdlkfjskj</a>.toString();
[19:34] <ashb> yeah. i wouldn't rule out modjs codebase tho :)
[19:35] <Wes--> ashb: I'm not. ;)
[19:38] * ondras just learned that "var a = 3" at global level creates a property with DontDelete
[19:38] <ashb> o_O
[19:38] <ashb> not quite sure why its don't delete
[19:38] <ondras> neither am i
[19:38] <ashb> but then flusspferd doesn't run anything in the global scope anymore
[19:38] <ondras> but ecma262 is very clear about that :)
[19:38] <Wes--> there is no requirement that global is the var object
[19:38] <ashb> not since the main-is-a-module change
[19:38] <Wes--> iirc
[19:39] <ondras> Wes--: true, but I am not sure if one can even try to delete a "var a" from a non-global area...
[19:39] <ondras> ashb: exactly, it is related to this :)
[19:39] <Wes--> ondras: There is no guarantee that you can even "name" the var object from script, IIUC
[19:39] <ondras> yes
[19:40] <ashb> there is also no requirement for the var object o be a proper js object
[19:40] <ondras> well, when v8cgi moves to main-is-a-module, this won't be an issue anymore.
[19:40] <ashb> it i s only a conceptual one
[19:40] <ashb> on a side note - i discoverd how to create 'custom repls with top level functions'
[19:41] <ashb> which is <3
[19:41] <Wes--> ashb: what do you mean?
[19:41] <Wes--> I think it might even be > 3
[19:41] <humbletim> ondras: wow, check this out even -- js> (function () { var a = 2; delete a; })+'' == 'function () { var a = 2; false; }'
[19:41] <ashb> http://github.com/ashb/juice/blob/master/skeleton/script/console
[19:41] <ashb> ./script/console
[19:41] <ashb> > get('/')
[19:41] <ashb> and it works
[19:42] <Wes--> ...why wouldn't it?
[19:42] <Wes--> I do stuff like all the time, although I use consts
[19:43] <Wes--> recall, prop/method -- false dichotomy
[19:43] <ashb> we dont have a repl in JS yet
[19:43] <ashb> which i guess would make it easier
[19:43] <Wes--> ashb: I do, but it depends on my curses module
[19:44] <Wes--> ashb: if you have something curses-like, you could steal me JS implementatin of readline ;)
[19:44] <ashb> Wes--: so basically we use the --interactive mode in the evn far line
[19:44] <ashb> whic says - run the code, but instead of quitting at the end, start the reupl
[19:44] <ashb> *env var
[19:45] <Wes--> ashb: Ah, that makes sense. If I want to do something like that, I have to do the exact opposite:
[19:45] <Wes--> gsr -c 'command;command;command' -f sample/repl/jsie.js
[19:45] <ondras> humbletim: wow :)
[19:47] <humbletim> ondras: yeah, and change delete a to delete b (undefined) and the delete b; line passes through just fine
[19:50] <ondras> humbletim: however, that behavior is specific to SM
[19:50] <ondras> (and possibly rhino)
[19:51] <humbletim> ondras: haven't tested rhino (only smjs17/18rc1). curious as well is that a third pass removes the false; line too js> (eval( (function () { var a = 2; delete a; })+'')+'').replace(/\n/g,' ') == function () { var a = 2; }
[19:51] <ondras> :}
[19:52] <humbletim> ondras: rhino 1.7 doesn't exhibit it
[19:55] <ondras> okay
[20:19] <humbletim> in current implementations, are primordials shared between modules? Array === Array?
[20:19] <MisterN> humbletim: as long as it is not spec'd, you probably shouldn't rely on it
[20:20] <MisterN> humbletim: but probably a good question for the ML :)
[20:21] <humbletim> MisterN: i'm using it as a kludge right now for inter-module state (actually grafting props onto 'Function', which is rarely enumerated in existing client-side browser libs), but just curious how long that'll continue to work for me
[20:22] <MisterN> humbletim: make a module for state :)
[20:23] <MisterN> require('humbletims-humble-state').iCanSetStuff = true
[20:23] <frodenius> who needs state anyway
[20:23] <frodenius> and that file would be empty? :p
[20:24] <Wes--> i believe there have been discussions to the effect that instanceof Array should behave as expected across modules
[20:25] <Wes--> that would imply that Array === Array
[20:25] <Wes--> and, more subtly, that that only holds when nobody's screwed with Array
[20:25] <MisterN> which does not, however, imply that storing state on Array or Function is a good idea.
[20:25] <Wes--> so that [] instanceof Array works as you would expect as well
[20:25] <Wes--> absolutely
[20:26] <Wes--> I am just waiting for humbletim to get some experience in this field, I think he will find that he is doing a lot of work he doesn't need to
[20:26] <humbletim> Wes-: hmm, same issue exists in some browsers today (eg: between windows), just anticipating XPCNativeWrapper concepts coming into play.
[20:27] <Wes--> humbletim: inter-window object exchange occurs with two separate globals
[20:27] <Wes--> I would not expect one Array to be === to another
[20:28] <Wes--> I don't know what the w3c has to say in this regard, however
[20:28] <Wes--> I do not work with the browser anymore
[20:30] <humbletim> Wes-: for what its worth, the commonjs initiative rocks. there isn't enough there yet to write portable modules tho
[20:31] <inimino> this is why Array.isArray was added to ES5
[20:31] <MisterN> i don't think moving objects between globals is a glorious idea.
[20:32] <humbletim> MisterN: i don't either but something along these lines is needed for resolving dependencies dynamically
[20:32] <MisterN> humbletim: huh?
[20:33] <MisterN> are we talking about the same thing?
[20:33] <humbletim> MisterN: oops, nope, sorry
[22:25] <ashb> anyone know if any engines other than mozilla's support |for each (x in y)|
[22:46] <Wes-> ashb: for each is official e4x, fwiw
[22:46] <ashb> yeah i know
[22:47] <ashb> the one good hting to come out of e4x
[22:48] <MisterN> ashb: you mean other than multi-line string literals? :D
[22:48] <ashb> i'd much rather a proper """ constructor fwiw
[22:48] <ashb> but yeah :)
[22:49] <Wes-> ashb: "abc" + "def" is not significantly more expensive than "abcdef" in tracemonkey
[22:50] <ashb> its not the expense - its the visualls :)

 

 

Logs by date :