Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can we just implement Python (or anything else, really, hell I'll even take VB at this point) in the browser already and get rid of this monstrosity of a language? Please?


Really? Python's handling of reaching into the outer scope of a function is just as confusing (although I hear it is fixed in 3000?).

Python used to be my favorite language, but I'm currently working on a project that is CoffeeScript on the client and Python on the server, so I'm getting plenty of time to compare them side by side. It would be difficult to overstate how much I prefer working with CoffeeScript.

The thing is, this scope situation, which is admittedly not as elegant as it could be, is really a rare situation to run into. If it happens to you often, it generally means that you need to give your more global variables less vague names.


Really? Python's handling of reaching into the outer scope of a function is just as confusing (although I hear it is fixed in 3000?)

Do you mean:

   try:
     foo = '42'
   except Whatever:
     raise
   print "foo is %s" % foo
If so, I really like that feature. It's much clearer to me than what I'd write in another language:

   foo = None
   try:
     foo = 42
   ...


Perhaps mistercow means things like

  def foo():
    x = 5
    def bar():
      print x
    def baz():
      x = 6
      print x
    bar()
    baz()
    print x
Which prints 5, 6, 5. If baz tried to print x before assigning, it would be an UnboundLocalError.


I believe you are referring to the nonlocal keyword, which means that unlike the regular case (assignment binds as locally as possible), assignment will bind where the name is bound now. (There's a third case for globals, but let's not talk about those.)


If we'd implement the JVM in the browser, we'd get Java as well as Jython/JRuby/Clojure/Scala almost for free.


Given that Oracle is now going around and suing companies that put Java to a use they don't approve of (see: the Google lawsuit over Dalvik), it appears that the JVM is too IP-encumbered to be a suitable candidate for a web standard.

Edit: imagine what a failure case it would be for the web if Oracle owned the IP rights to a core web standard and actively asserted them. Yikes.


It's been done before:

http://pyjs.org/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: