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.

Wherein Javascript borrows a language feature from Arc

23 pointsby youngnhover 15 years ago

4 comments

WilliamLPover 15 years ago
&#62; geolocator.getLatLng("Forest Park, St. Louis, MO", function(center) {<p>&#62; displayMapAt(center, 14);<p>&#62; });<p>To my eyes, that solution is just fine. I don't think I'll ever be swayed to believe that adding on layers of indirection to JavaScript code for the sake of "syntactic goodness" is rationally motivated by leading to more practical power for actually solving problems.
评论 #924409 未加载
评论 #924215 未加载
tlrobinsonover 15 years ago
You should probably assign an object to the underscore, otherwise any argument which is undefined will match:<p><pre><code> js&#62; var _ js&#62; _ == undefined true </code></pre> Just doing "var _ = {}" should be sufficient.<p><i>edit: however, this conflicts with Underscore.js (<a href="http://documentcloud.github.com/underscore/" rel="nofollow">http://documentcloud.github.com/underscore/</a>), but if you put an "if (typeof _ === "undefined")" around the assignment you should be ok</i>
评论 #924218 未加载
评论 #924441 未加载
scott_sover 15 years ago
Can someone explain why this:<p><pre><code> geolocator.getLatLng("Forest Park, St. Louis, MO", displayMapAt); </code></pre> Is better than this?<p><pre><code> displayMapAt(geolocator.getLatLng("Forest Park, St. Louis, MO")); </code></pre> That is, why is it more sensible for getLatLng to accept a callback function that will accept its result, when one can just pass its result to a function?
评论 #924820 未加载
评论 #924879 未加载
mdemareover 15 years ago
Clojure has #(+ % 10) for Arc's [+ _ 10]. Does anyone know if Arc inspired Clojure, or whether there's prior art for this syntax?
评论 #924711 未加载
评论 #924691 未加载
评论 #924310 未加载
评论 #924977 未加载