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

Can you get around (at least some of) those restrictions by wrapping things in function expressions? Here's a for loop: ((function(){ for(x in [1,2,3]){print(x)} })(), 42)


Yes, and we have some macros that do just that (a Greenspunned version of half of CL's LOOP comes to mind). But it's not great as a general solution because of what it makes you give up in performance and readability. Also, it doesn't solve the problem of declaring new variables.

Every now and then we hit upon a new abstraction that lets us remove another chunk of ugliness from our code (while still generating acceptable JS) and I'm hoping that the trend will continue, especially if we can get rid of all those "return"s.




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

Search: