[{"data":1,"prerenderedAt":229},["ShallowReactive",2],{"project-1848643":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":40,"post_text":42,"what":43,"said":63,"maker_in_thread":146,"shape":157,"grid":161,"attempts":197,"same_week":198,"maker_shows":31,"maker_hidden":221,"reader_version":222,"card":223},"1848643","PJ (pyxc)","a compiler from Python syntax to JavaScript syntax (like CoffeeScript)","title","Show HN: a compiler from Python syntax to JavaScript syntax (like CoffeeScript)","http:\u002F\u002Fpyxc.org","pyxc.org","endian",1288380392,2010,32,18,55,370,15,"shown","languages","transpiler","cli",[24,21,25,26,27],"python to javascript","javascript syntax","coffeescript alternative","source-to-source compiler","debated",-0.222,{"positive":31,"neutral":32,"mixed":33,"critical":32},2,3,0,8,{"docs":36,"execution":38,"idea":39},{"positive":33,"critical":37},1,{"positive":33,"critical":31},{"positive":31,"critical":33},[33,37,33,33,32,33,32,33,37,33,33,37,33,32,33,41,41,33],5,null,{"problem":44,"audience":42,"pricing":42,"motivation":42,"time_to_build":42,"stack":51,"openness":62,"stage":62,"team_size":62},{"value":45,"source":46,"evidence":47},"Writing JavaScript with a less horrible syntax","maker",[48],{"id":49,"by":11,"text":50},"1849029","PJ is a way to do your JavaScript coding using a less horrible syntax.",[52,58],{"value":53,"source":54,"evidence":55},"Python","inferred",[56],{"id":57},"post",{"value":59,"source":54,"evidence":60},"JavaScript",[61],{"id":57},"unknown",{"praise":64,"objections":81,"requests":97,"questions":105,"alternatives":113},[65],{"value":66,"source":67,"evidence":68},"Neat idea and good competition for compilers","commenter",[69,73,77],{"id":70,"by":71,"text":72},"1848875","tjarratt","This is a really neat idea, and I'm definitely going to look into this more when I have time, but I have a small nit to pick. print(...) is a common debugging, or output call in…",{"id":74,"by":75,"text":76},"1849127","plinio_silva","This would be fantastic to write validation code, because the same code can be used on both the server and client sides. Thanks endian for sharing this with us, I can't wait to…",{"id":78,"by":79,"text":80},"1849300","hasenj","Better way of writing javascript (just like coffe script). You can embed this in a web app and write your client-side code in python-syntax. Would work specially well if you…",[82,93],{"value":83,"source":67,"evidence":84},"Python and JavaScript differ enough that docs and scaffolding are needed",[85,89],{"id":86,"by":87,"text":88},"1848779","jiaaro","I think that python is sufficiently different from javascript that you'll need to provide your own documentation beyond explaining the transformation. Coffeescript is mostly just…",{"id":90,"by":91,"text":92},"1849767","JeffJenkins","I wrote one of these for a project. The trouble is that to write functioning python code, even for just the primitives, you have to add a lot of extra scaffolding. I eventually…",{"value":94,"source":67,"evidence":95},"print() may not work in all browsers or server-side JS",[96],{"id":70,"by":71,"text":72},[98],{"value":99,"source":67,"evidence":100},"Document which Python features count as syntax versus runtime",[101],{"id":102,"by":103,"text":104},"1848839","s3graham","I guess defining what you consider syntax features vs. Python language\u002Fruntime would be appropriate for the docs. ie. 2 * * 1024? print object.__mro__? slice objects? __call__?…",[106],{"value":107,"source":67,"evidence":108},"Which use cases is this compiler helpful for",[109],{"id":110,"by":111,"text":112},"1848852","random42","For which use cases this compiler would be helpful? I believe python and JavaScript are typically used for different purposes. That being said, it looks fantastic. :) Disclaimer…",[114,121,128,132,139],{"value":115,"source":67,"evidence":116},"CoffeeScript",[117,118],{"id":86,"by":87,"text":88},{"id":119,"by":103,"text":120},"1848784","At first blush, I'd say this similar to Coffeescript in that it's meant to be javascript shorthand also.",{"value":122,"source":67,"evidence":123},"Pyvascript",[124],{"id":125,"by":126,"text":127},"1849236","daeken","I built something similar a while back (guess it's been in use for about two years now -- built it to support my company's product): http:\u002F\u002Fgithub.com\u002Fdaeken\u002FPyvascript Key…",{"value":129,"source":67,"evidence":130},"Pyjamas",[131],{"id":90,"by":91,"text":92},{"value":133,"source":67,"evidence":134},"pythonicjavascript",[135],{"id":136,"by":137,"text":138},"1849741","reinhardt","A more conservative (i.e. closer to the generated javascript) approach is pythonicjavascript (http:\u002F\u002Fcode.google.com\u002Fp\u002Fpythonicjavascript\u002F). Personally I prefer making Javascript…",{"value":140,"source":67,"evidence":141},"prettyscript",[142],{"id":143,"by":144,"text":145},"1849570","extension","Here's my thing like this for Ruby: http:\u002F\u002Fgithub.com\u002Fjedediah\u002Fprettyscript I abandoned it when CoffeeScript appeared, but you might find something interesting there.",{"comments":41,"answered":31,"key":147},[148,151,154],{"id":149,"text":150},"1848800","Exactly. It's purely syntax to syntax. Thanks for the confusion -- I've made the first paragraphs more clear about PJ's scope. Title changed: s\u002Fcompiler\u002Fsyntax cross-compiler\u002F…",{"id":152,"text":153},"1848929","Here's the decision procedure: If there's no collateral damage and the JS is clear (e.g. 28 --> Math.pow(2, 8)): do it. If there's no proper way to express the JS in Python (e.g.…",{"id":155,"text":156},"1848899","Thanks. I'll change ``` pj.transformations.special.Call_print ``` to have the emitted code check if you've defined a print function, using console.log only if you haven't. ```…",{"commenters":158,"max_depth":41,"maker_replies":41,"first_comment_mins":159,"lifespan_hours":160},13,24,6,[162,164,166,167,169,171,172,176,177,179,181,185,186,187,189,191,192,193],[125,33,33,163,126,33],"commenter\u002Fneutral\u002Fidea",[86,37,37,165,87,33],"project\u002Fcritical\u002Fdocs",[119,37,33,163,103,33],[149,37,33,168,11,37],"project\u002Fneutral\u002Fidea",[102,37,32,170,103,33],"project\u002Fneutral\u002Fdocs",[152,37,33,168,11,37],[173,37,32,174,175,33],"1848938","maker\u002Fneutral\u002Fdocs","scott_s",[143,31,33,163,144,33],[70,32,37,178,71,33],"project\u002Fcritical\u002Fexecution",[155,32,33,180,11,37],"maker\u002Fpositive\u002Fexecution",[182,183,33,184,11,37],"1848736",4,"maker\u002Fneutral\u002Fnone",[90,41,37,178,91,33],[136,160,33,163,137,33],[110,188,32,168,111,33],7,[49,188,33,190,11,37],"project\u002Fpositive\u002Fidea",[74,188,41,190,75,33],[78,188,41,190,79,33],[194,34,33,195,196,33],"1848887","other\u002Fneutral\u002Fnone","bhiggins",[],[199,204,208,212,215,218],{"id":200,"name":201,"points":202,"category":203},"1866754","Instant Movie\u002FTV Search",31,"consumer_social",{"id":205,"name":206,"points":188,"category":207},"1851070","Gundo","dev_tools",{"id":209,"name":210,"points":32,"category":211},"1843182","readTHERE","productivity",{"id":213,"name":214,"points":32,"category":211},"1847121","Scrybe",{"id":216,"name":217,"points":31,"category":211},"1845905","TextDrop",{"id":219,"name":220,"points":31,"category":203},"1846730","drinkkit",false,"v2",{"id":224,"name":5,"line":6,"ai":221,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":225,"top":18,"kw":226,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":227,"url":9,"mix":228,"praise":66,"objection":83,"sub":21},1848643,-0.22,[24,21,25,26,27],"010030301001030550",[31,32,33,32],1793990868402]