TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JavaScript rapid function definition

12 pointsby SlyShyabout 15 years ago

1 comment

pakabout 15 years ago
This is abusive, not clever. Anything that forces you to code things as opaque string literals that get eval'ed is not a good idea. The next person to come along is going to wonder "what is this doing inside a string? what is r?" You also lose syntax highlighting and debuggability. Building the expression strings dynamically is going to be too tempting, and then you will have code generation and the potential for security issues. It's not even that much shorter than building the closure.
评论 #1373699 未加载